Prev: function
Next: Test if vectors are the same size
From: Abhishek on 19 Jul 2010 11:20 i am reading from file of type vout=x; vin=y; using textscan(fid,'%s','delimiter','=') and getting 'vout' 'x;' 'vin' 'y;' how to read without getting these(') please help thankyou
From: Steven_Lord on 19 Jul 2010 11:21 "Abhishek " <abhi14jan(a)yahoo.com> wrote in message news:i21q0d$5sg$1(a)fred.mathworks.com... > hi > i am extracting text from file which contains > vout=x; > vin=z; > eq1=A*p+B*u; > > using > c=textscan(fid,'%s','delimiter','=') > which gives output as > 'vout' > 'x;' > 'vin' > 'z;' > 'eq1' > 'A*p+B*u;' > please help me to get rid of (') This is reading in your file into a cell array, and that's how strings (char arrays) inside cell arrays are displayed if they're short. If you extract the _contents_ of each cell from that cell array, those contents will not include a single quote (unless one was present in the original text.) c{1} -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: Andy on 19 Jul 2010 11:24 Just because you did not get an immediate reply is no reason to repost your question several times. Please tell us more about what you're trying to do. Specifically, if you do not want textscan to return strings, why do you use '%s' as your format string? Perhaps you should start by reading the documentation for textscan.
From: Walter Roberson on 19 Jul 2010 11:27 Abhishek wrote: > hi > i am extracting text from file which contains > vout=x; > vin=z; > eq1=A*p+B*u; > > using > c=textscan(fid,'%s','delimiter','=') > which gives output as > 'vout' > 'x;' > 'vin' > 'z;' > 'eq1' > 'A*p+B*u;' > please help me to get rid of (') What happens if you add ' to the Whitespace parameter of textscan() ? See also regexp, strfind, strtok, ismember, eq, and http://www.mathworks.com/access/helpdesk/help/techdoc/learn_matlab/f2-644.html#f2-800 And next time, please do not post the same question 4 times. In the time you spent impatiently waiting for someone to answer, you could have searched the matlab help for keywords such as "string" and found appropriate operations.
From: Abhishek on 19 Jul 2010 11:36
"Steven_Lord" <slord(a)mathworks.com> wrote in message <i21qi2$bbv$1(a)fred.mathworks.com>... > > > "Abhishek " <abhi14jan(a)yahoo.com> wrote in message > news:i21q0d$5sg$1(a)fred.mathworks.com... > > hi > > i am extracting text from file which contains > > vout=x; > > vin=z; > > eq1=A*p+B*u; > > > > using > > c=textscan(fid,'%s','delimiter','=') > > which gives output as > > 'vout' > > 'x;' > > 'vin' > > 'z;' > > 'eq1' > > 'A*p+B*u;' > > please help me to get rid of (') > > This is reading in your file into a cell array, and that's how strings (char > arrays) inside cell arrays are displayed if they're short. If you extract > the _contents_ of each cell from that cell array, those contents will not > include a single quote (unless one was present in the original text.) > > c{1} > > -- > Steve Lord > slord(a)mathworks.com > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ > To contact Technical Support use the Contact Us link on > http://www.mathworks.com >thanks steve >one more help >i have cs= 'Vout' 'x;' 'Vin' 'z;' 'eq1' 'A*p+B*u;' on writing c(6) i get 'A*p+B*u;' how to go inside c(6) |