problems in long string assignment

problems in long string assignment

Post by workaholi » Thu, 03 Sep 2009 17:37:13


want to assign a very long string to a variable, I first write
a .sce file containing the string, but I find that scilab 4.1.2 always
report error on a constant length of part of the whole string.

So I copied the long string directly to the command window, I found
that scilab stopped displaying the whole string on one of the string
position, I don't know why, is there some string length limit on
assigning command.

Here is the long string, just one part of it.
eqstr=cell(3,1);
eqstr(1).entries=".104862e-1*ddtheta1*sin(theta2)*q11-.
556822e-2*dtheta1*cos(theta2)*dtheta2*q12^2*q21+.
343122e-3*dq11*q12*dq22-.142668e-1*ddq21-.158333e-1*sin(theta2)
*dtheta2^2+.158333e-1*dtheta2*cos(theta2)+.575758e-1*dtheta1*q12*dq12-.
135431e-3*ddq22*q12^2+.524310e-2*q11*cos(2.*theta2)*dtheta2^2-.
336687e-1*dtheta1*sin(theta2)*dq12+.148011e-1*ddtheta1*q22^2-.
166064e-3*dtheta1*q12*sin(theta2)*dq11*q22+.274372e-2*sin(theta2)
*dtheta2^2*q11*q22^2*q12+.114533e-3*dtheta2*cos(theta2)
*q12^2*dq21*q22+.285442e-3*dq12*sin(theta2)*dtheta2*q22*q11+.
552336e-2*sin(theta2)*dtheta2^2*q11*q21^2*q12+.
666629e-2*dtheta1*q11^2*sin(theta2)*dq21+.337015e-1*dtheta1*dq12*cos
(theta2)*q21+.229065e-3*dtheta1*q12^2*dq21*q22-.139206e-2*dq21*sin
(theta2)*dtheta2*q12^2+.367587e-3*dtheta1*q11^2*q21*dq22+.297960e-1*cos
(theta2)*dtheta2*q21*dq21-.548744e-2*dtheta1*dq11*q22^2*q12+.
415159e-4*ddq22*cos(theta2)*q12*q11-.556822e-2*ddtheta1*q12^2*sin
(theta2)*q21-.349844e-2*sin(theta2)*dtheta2^2*q11^2*q21^2+.
500000e-1*ddtheta1*cos(theta2)+.327492e-1*ddtheta1*q11*q12+.
699687e-2*ddtheta1*q11^2*q21^2-.290175e-3*dtheta2*q11*cos(theta2)
*q21*dq12*q22-.121265e-1*dq11*sin(theta2)*dq21+.
216590e-2*ddtheta1*q12^2*q22^2-.106365e-3*ddq12*sin(theta2)*q22+.
957272e-2*dq12*sin(theta2)*dq21-.148980e-1*q21^2*sin(theta2)
*dtheta2^2+.156536e-2*dtheta1*dq21*q22-.463978e-2*dtheta1*cos(theta2)
*dtheta2*q22-.336687e-1*ddtheta1*sin(theta2)*q12+.307903e-2*dq11*sin
(theta2)*dtheta2*q21*q12+.502500e-1*dtheta2+.114622e-2*ddq12*cos
(theta2)+.463391e-2*dtheta2*cos(theta2)*q12*dq12-.463978e-2*dtheta1*sin
(theta2)*dq22+.595920e-1*dtheta1*q21*dq21-.950241e-2*ddq11*sin(theta2)
*q21+.500487e-1*ddtheta1*sin(theta2)*q21-.379277e-3*dq11*dq21*q22-.
379277e-3*dq11*q21*dq22+.347568e-2*ddtheta1*q11^2*q22^2+.
112419e-2*dq11*sin(theta2)*dq22-.887442e-3*dq12*sin(theta2)*dq22+.
740055e-2*dtheta2*q22^2*cos(theta2)+.114734e-2*ddq12*sin(theta2)*q21+.
782679e-3*dtheta2*q21*cos(theta2)*q22+.516204e-3*dtheta1*q12^2*sin
(theta2)*dq22-.104964e-1*ddtheta1*q11*cos(theta2)*q21-.
782679e-3*q21*sin(theta2)*dtheta2^2*q22-.173784e-2*q11^2*sin(theta2)
*dtheta2^2*q22^2+.367587e-3*ddtheta1*q11^2*q21*q22-.
548744e-2*ddtheta1*q11*q22^2*q12-.580349e-3*ddtheta1*q11*q21*q12*q22+.
458130e-3*dtheta1*q12*q21*q22*dq12+.569902e-2*ddq12*q21^2+.
513833*ddtheta1+.343122e-3*ddq22*q11*q12-.
278140e-2*dtheta2*dq12*q12*cos(2.*theta2)+.
447391e-3*dtheta2*dq12*q11*cos(2.*theta2)-.949316e-2*ddq11*cos
(theta2)+.290175e-3*sin(theta2)*dtheta2^2*q11*q21*q12*q22-.
309001e-3*q11^2*q22*cos(2.*theta2)*dtheta2^2+.
129051e-3*dtheta2*q12^2*dq22*sin(2.*theta2)+.104862e-1*dtheta1*sin
(theta2)*dq11-.279410e-2*dtheta2*cos(theta2)*dq11*q12+.
735174e-3*dtheta1*q11*q21*q22*dq11-.717244e-2*dq11*q22*dq22+.
156536e-2*ddtheta1*q21*q22-.463978e-2*ddtheta1*sin(theta2)*q22+.
156536e-2*dtheta1*q21*dq22+.125122e-1*dq21*sin(theta2)*dtheta2-.
307903e-2*dq12*sin(theta2)*dtheta2*q11*q21-.781078e-3*dq22*cos(theta2)
*dtheta2*q12+.178956e-2*dthe
 
 
 

problems in long string assignment

Post by Francois V » Sun, 06 Sep 2009 03:46:12

workaholic said on 02/09/2009 10:37:

From my personal analysis of a very similar problem I bumped into
during the development of Scipad:

On the command line, Scilab cannot accept commands longer than bsiz
(they get truncated).

Workaround: Long commands can be saved into a file that is then exec'ed.

Limitation of this workaround: exec will work as long as the length is
smaller than lsiz.

If the length is greater than lsiz-1, then I think the command just
cannot be passed to Scilab. If you find a way of doing this I would be
interested too.

In Scilab-4.1.2 (and Scilab 5 too), bsiz is 4096 and lsiz is 65536
(see stack.h).

That said, see also
http://www.yqcomputer.com/ #c4
about what you could perhaps do.

Francois

 
 
 

problems in long string assignment

Post by Francois V » Sun, 06 Sep 2009 03:53:42

> Workaround: Long commands can be saved into a file that is then exec'ed.

Sorry I forgot to mention: this will work as long as you process your
string minimally before exec'ing it, i.e. cut it in chunks of size
slightly smaller than bsiz and add continuation dots after each but
the last line in the file.

Francois
 
 
 

problems in long string assignment

Post by workaholi » Sun, 06 Sep 2009 17:52:45


Thanks for your guidance, that fits my guess.

As for the solution, it is the my first response to save it in a file
and execute it, but it appears not working. :(

And I will try the truncation , thanks!