P_0frF67
P_0frF67

Reputation: 11

How to run run mcc in a loop in Matlab

I need help to use mcc -mv in a for loop. Specifically, I have matlab files names as Myfiles_k.m where k runs from 1:n. I want to do something like the following

for i=1:n 
fname = ['Myfiles_',num2str(i),'.m']; 
mcc -mv fname
end 

This leads to the following error:

Could not determine type of the MATLAB file 'fname'. Please make sure that you are compiling MATLAB Program files.

Could anyone help with letting me know what am I doing wrong here?

Upvotes: 1

Views: 154

Answers (1)

Cris Luengo
Cris Luengo

Reputation: 60564

The command

mcc -mv fname

is interpreted as

mcc('-mv','fname')

That is, the arguments are seen as strings. You have a variable containing a string you want to pass to mcc, this requires:

mcc('-mv',fname)

Upvotes: 1

Related Questions