Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.


Math Forum
»
Discussions
»
Software
»
comp.softsys.matlab
Notice: We are no longer accepting new posts, but the forums will continue to be readable.
Topic:
Matlab says that the command is too long to execute
Replies:
3
Last Post:
Jun 10, 2011 1:04 PM




Re: Matlab says that the command is too long to execute
Posted:
Jun 10, 2011 12:19 PM


Hello Steve Lord,
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:
z=python('squared.py',num2);
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,
Nazmul
"Steven_Lord" <slord@mathworks.com> wrote in message <ist9fk$m3h$1@newscl01ah.mathworks.com>... > > > "Nazmul Islam" <nazmul.islam@gmail.com> wrote in message > news:isr8oi$8ir$1@newscl01ah.mathworks.com... > > 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 MatlabPython > > 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/16MSYAZ/?solution=16MSYAZ > > 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 > slord@mathworks.com > To contact Technical Support use the Contact Us link on > http://www.mathworks.com



