execute cell content as lines of command in Matlab
Show older comments
I have a cell that cintains execution command such as
A{1} = python run_my_code -m var1="1" var2 ="2"
A{2} = python run_my_code -m var1="2" var2 ="4"
...
When I use system(A{1}) it gives me sytax error.
The idea is to run all cell contetnts in a for loop within matlab.
Any help is appreciated
3 Comments
Are you assigning those values to A exactly as shown? If you are, you need to wrap them in quotes.
A = cell(1,2);
A{1} = 'python run_my_code -m var1="1" var2 ="2"' % this is a char vector
A{2} = python run_my_code -m var1="2" var2 ="4" % this is an invalid expression
Hamid
on 28 Jan 2022
DGM
on 28 Jan 2022
I am not familiar with python, but if the errors are with python instead of matlab, then environment configuration sounds like something worth looking into.
Answers (1)
Yongjian Feng
on 29 Jan 2022
Try this first from matlab command line window:
pe = pyenv
This will tell you what python env is used by your matlab installation.
Categories
Find more on Call Python from MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!