From: Abhishek on 20 Jul 2010 01:37 hi i am reading the file x z o,p,q,r,s,t,u,v,w,x,T A*p+B*u y*p+D*q+E*r+F*s G*q+H*r+I*t J*q+K*s+L*x M*r+N*o+O*t+2*x*P 2*x*Q+R*o+S1*s+P*t+U*T+V*z W*o+N*t+X*T+R*2*x+Y*v d*w+e*v+f*u g*u+h*p+i*w+j*v k*v+l*o+m*w+n*u Z*T+2*x*a+b*z+c*o using fid=fopen('/sim/TLV1117LV_DS/x0138322/scripts/userinput.m'); while(1) tline1 = fgetl(fid); if ~ischar(tline1), break, end TL1 = sym(tline1); end but it is returning TL1= [empty sym] tell me a solution; thank you in advance
From: Walter Roberson on 20 Jul 2010 04:12 Abhishek wrote: > hi i am reading the file > x > z > o,p,q,r,s,t,u,v,w,x,T > A*p+B*u > y*p+D*q+E*r+F*s > G*q+H*r+I*t > J*q+K*s+L*x > M*r+N*o+O*t+2*x*P > 2*x*Q+R*o+S1*s+P*t+U*T+V*z > W*o+N*t+X*T+R*2*x+Y*v > d*w+e*v+f*u > g*u+h*p+i*w+j*v > k*v+l*o+m*w+n*u > Z*T+2*x*a+b*z+c*o > > using > fid=fopen('/sim/TLV1117LV_DS/x0138322/scripts/userinput.m'); > while(1) tline1 = fgetl(fid); > if ~ischar(tline1), break, end > TL1 = sym(tline1); > > end > but it is returning TL1= > [empty sym] > tell me a solution; > thank you in advance sym() is not documented as being able to take a string which is a symbolic expression: strings are documented only to be valid if they indicate variable names or symbolic numbers. A generous interpretation of "symbolic number" might allow for the possibility (I cannot test this), but if so then your line with the string of variables separated by commas would at best have the result of assigning an "expression list" to TL1 rather than necessarily creating variables with each of the mentioned names. Also, there is the possibility that your file has an empty line right before end of file. If that were to be the case, then because you do not check that the string is non-empty or non-blank, you would be attempting to create a symbolic variable with an empty name, which would be the empty symbol.
From: Abhishek on 20 Jul 2010 04:51 Walter Roberson <roberson(a)hushmail.com> wrote in message <XTc1o.10562$Zp1.7179(a)newsfe15.iad>... > Abhishek wrote: > > hi i am reading the file > > x > > z > > o,p,q,r,s,t,u,v,w,x,T > > A*p+B*u > > y*p+D*q+E*r+F*s > > G*q+H*r+I*t > > J*q+K*s+L*x > > M*r+N*o+O*t+2*x*P > > 2*x*Q+R*o+S1*s+P*t+U*T+V*z > > W*o+N*t+X*T+R*2*x+Y*v > > d*w+e*v+f*u > > g*u+h*p+i*w+j*v > > k*v+l*o+m*w+n*u > > Z*T+2*x*a+b*z+c*o > > > > using > > fid=fopen('/sim/TLV1117LV_DS/x0138322/scripts/userinput.m'); > > while(1) tline1 = fgetl(fid); > > if ~ischar(tline1), break, end > > TL1 = sym(tline1); > > > > end > > but it is returning TL1= > > [empty sym] > > tell me a solution; > > thank you in advance > > sym() is not documented as being able to take a string which is a > symbolic expression: strings are documented only to be valid if they > indicate variable names or symbolic numbers. A generous interpretation > of "symbolic number" might allow for the possibility (I cannot test > this), but if so then your line with the string of variables separated > by commas would at best have the result of assigning an "expression > list" to TL1 rather than necessarily creating variables with each of the > mentioned names. > > > Also, there is the possibility that your file has an empty line right > before end of file. If that were to be the case, then because you do not > check that the string is non-empty or non-blank, you would be attempting > to create a symbolic variable with an empty name, which would be the > empty symbol. >thanks >but tell me how to check whether the string is empty or not and where to check it ??
|
Pages: 1 Prev: Problem: worldmap after imshow or surf(peaks) Next: Help importing a Java class!!! |