1

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?

Cris Luengo
  • 55,762
  • 10
  • 62
  • 120
P_0frF67
  • 11
  • 3
  • Possible duplicate of [Matlab Calling Functions without parentheses](https://stackoverflow.com/questions/45234314/matlab-calling-functions-without-parentheses) – sco1 Mar 27 '18 at 17:35

1 Answers1

1

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)
Cris Luengo
  • 55,762
  • 10
  • 62
  • 120