How to Use MATLAB 'system' Function to Open Multiple Terminals?

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 5K views
GreenLRan
Messages
59
Reaction score
0
Hi,
I need to call the system function to open up several other MATLAB terminals and call a function I wrote that will have variable input. I have tried a lot of different methods but to no avail. This is basically what I'm trying to do.


for i = 1:numberOfTerminals

system('C:\MATLAB\R2009b\bin\matlab -r myFunction(var1*i,var2)')

end

I get errors saying the variables are undefined.

I have tried

...

system(['C:\MATLAB\R2009b\bin\matlab -r myFunction(', var1*i, var2, ')' ]);

and

system(['C:\MATLAB\R2009b\bin\matlab -r myFunction(%var1*i%,%var2%)' ]);

etc...

Thanks for the help!
 
Physics news on Phys.org
I solved it myself.

For those interested, it can be done..

str = ['C:\MATLAB\R2009b\bin\matlab -r Func(', num2str(var1), ',' ,num2str(var2) ',',num2str(var3), ')'];

system(str)