Thanks a lot for your feedback. It is exceeding the limit allowed by DOS!! I have two questions for you:
1. Can I send this data as a bin file to the Python program? As far as I have seen, the python command only accepts a string, e.g, in the following command:
If num2 is anything apart from a string, Matlab shows an error. I want to know if a bin file will also work.
2. I am currently trying to convert my array to a bin file. I am using the following command:
fid = fopen('nazmul.bin','wb'); // opening a bin file fwrite(fid,array1); // array1 is the array that I want to send to Python
However, it's not working properly. When I read the 'nazmul.bin' file, I find the output array to be completely blank.
fid = fopen('nazmul.bin','wb'); A=fread(fid);
I find A to be an empty array. Ideally, I would like A to be equal to array1. Can you please suggest what mistakes I am making here?
Thanks a lot,
"Steven_Lord" <email@example.com> wrote in message <firstname.lastname@example.org>... > > > "Nazmul Islam" <email@example.com> wrote in message > news:firstname.lastname@example.org... > > I am calling a Python program from Matlab and passing an array to the > > program. I am using the following steps: > > > > % Let us assume some random array > > num1 = ones(1,100); > > % I am forced to pass parameters as string due to the Matlab-Python > > interaction. > > num2 = num2str(num1); > > % The function is saved in a Python program called squared.py > > z=python('squared.py',num2); > > > > The program works find when the size of num1 is small (e.g. 100). However, > > when it large, e.g., 500000, Matlab shows the following error: > > > > ??? Error using ==> dos > > The command is too long to execute. > > > > Error in ==> python at 68 > > [status, result] = dos(pythonCmd); > > > > Does anyone know how to fix this error? > > Set a breakpoint on line 68 of python.m and look at the length of the > command string constructed by the python function that is being passed into > the DOS function. It likely exceeds the limit allowed by the DOS function on > your operating system. > > http://www.mathworks.com/support/solutions/en/data/1-6MSYAZ/?solution=1-6MSYAZ > > How to correct the problem would depend on what the python function does to > construct the command, so you'll likely need to ask the author of the python > function for help. > > -- > Steve Lord > email@example.com > To contact Technical Support use the Contact Us link on > http://www.mathworks.com