0

I am able to pass string(path) parameter to matlab script from python on Win 7 machine (and script runs successfully in new matlab command window) as:

matlab_cmd_string = MatlabExePth+ " -nosplash -nodesktop -wait -logfile   FileIoReg_MatlabRemoteRun.log -minimize -r "
mat_file = "tst_script"
tstPth = 'C\\SVN\\Matlabcode\\tst1'
mat_cmd = matlab_cmd_string + "\"" + mat_file + "("+ "\'" +  tstPth + "\'" + ")" + ", exit\""

so that above evalutes to

"C:\Program Files\MATLAB\R2013b\bin\matlab.exe" -nosplash -nodesktop -wait -logfile FileIoReg_MatlabRemoteRun.log -minimize -r "tst_script('C\SVN\Matlabcode\tst1'), exit"

However, now, i need to pass a List (which becomes matlab cell array) as argument ,so that Matlab be called as

tst_script1(Python_list)

However, what should be passed as argument in python is the list values , and not something like

"C:\Program Files\MATLAB\R2013b\bin\matlab.exe" -nosplash -nodesktop -wait -logfile FileIoReg_MatlabRemoteRun.log -minimize -r "tst_script1('Python_list'), exit"

in which Python_list is taken as a string.

How do I do that?
sedy

1 Answer 1

1

Here, this should work for you.

a = [1,2,3,4,5,6] 
matlab_cmd_string = MatlabExePth+ " -nosplash -nodesktop -wait -logfile   FileIoReg_MatlabRemoteRun.log -minimize -r "
mat_file = "tst_script"
tstPth = 'C\\SVN\\Matlabcode\\tst1'
listToBePassed = str(a)
mat_cmd = matlab_cmd_string + '\"' + mat_file + '(' + listToBePassed + ')' + ', exit\"'
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.