From: arhan on
In embedded matlab fcn in simulink, i am using this command;

Abc=S.(sprintf('pos%d_vel%d_bez_deg%d',82,60,4)).x_b;


S is a "struct" and is defined as parameter(non-tunable) in the embedded matlab fcn editor. actually i want to get the array x_b which is inside the structure S.
in simple we can write

Abc=S.pos82_vel60_bez_deg4.x_b (which works fine)

but i want to use "sprintf" function to make it generic..

but i get an error

"Function 'sprintf' implicitly resolved in the MATLAB workspace. Implicit evaluation in MATLAB is not supported. Please declare this function extrinsic using eml.extrinsic('sprintf'), or call it using feval."
From: Steven Lord on

"arhan " <arhan_yaqub(a)yahoo.com> wrote in message
news:i0khnq$ceu$1(a)fred.mathworks.com...
> In embedded matlab fcn in simulink, i am using this command;
>
> Abc=S.(sprintf('pos%d_vel%d_bez_deg%d',82,60,4)).x_b;
>
>
> S is a "struct" and is defined as parameter(non-tunable) in the embedded
> matlab fcn editor. actually i want to get the array x_b which is inside
> the structure S.
> in simple we can write
>
> Abc=S.pos82_vel60_bez_deg4.x_b (which works fine)
>
> but i want to use "sprintf" function to make it generic..
>
> but i get an error
> "Function 'sprintf' implicitly resolved in the MATLAB workspace. Implicit
> evaluation in MATLAB is not supported. Please declare this function
> extrinsic using eml.extrinsic('sprintf'), or call it using feval."

The error message indicates why you received the error and offered two
suggestions for how to correct your code. Do you have a question about how
to implement those suggestions? Have you tried implementing those
suggestions and experienced a problem doing so?

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com