Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
alternative to eval(['model' num2str(st)]) and "num2str"

Subject: alternative to eval(['model' num2str(st)]) and "num2str"

From: Louis

Date: 22 Oct, 2010 17:16:04

Message: 1 of 3

Hello

I am using eval(['model' num2str(st) ']) extensively! is there any alternative? this shows as the bottleneck in my loop :(

my code goes as follow:
%%
X= is some image
for st=1:N
function(eval(['model' num2str(st) ']), X) % apply model on the image
end
%%

So profile tells me that "num2str" is the bottleneck but i am thinking of any alternative to num2str or the entire eval(...) statement in the code above?

Thank you

Louis

Subject: alternative to eval(['model' num2str(st)]) and "num2str"

From: Louis

Date: 22 Oct, 2010 17:34:06

Message: 2 of 3

Solved :) FAQ 4.6

Subject: alternative to eval(['model' num2str(st)]) and "num2str"

From: Louis

Date: 3 Mar, 2011 00:24:25

Message: 3 of 3

"Louis" wrote in message <i9shue$47u$1@fred.mathworks.com>...
> Solved :) FAQ 4.6


Hello Folks,

I could solve the problem in my original post of avoiding 'eval' using 'cell' by following FAQ4.6. Now I want to change the same code to 'c' using Matlab embedded toolbox; however, the embedded toolbox doesn't support 'cell'.

I am thinking of going back to use 'eval' however i am not sure whether 'eval' works with the embedded toolbox.

Any insight to workaround this issue would be appreciated,

Regards,

Louis

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us