From: us on 10 Jul 2010 17:48 "us " one of the solutions - just in case you got your act together... fnam='foo.txt'; % <- your file name... s=textread(fnam,'%s','delimiter','\n'); s=regexprep(s,'[A-z]',''); r=cellfun(@(x) sscanf(x,'%g %g'),s,'uni',false); r=cat(2,r{:}).' %{ % r = % <- 10 records, only... 128.0000 90.0874 128.0000 92.0874 128.0000 94.0874 128.0000 96.0874 254.0000 96.1002 128.0000 98.0874 50.0000 99.1156 128.0000 100.0874 50.0000 101.1812 128.0000 102.0874 %} us
From: dpb on 10 Jul 2010 20:03 Alessandra wrote: .... > and if I run your script I get this error: > >>> s={stim}; >>> v=zeros(size(s)); > for idx=1:length(s), v(idx)=str2num(s{idx});end > ??? Error using ==> str2num at 33 > Requires string or character array input. .... Well, I presumed you would have the common sense to use your cell array instead of just blindly copying a quickie keyboard demonstration... :( I'm quite sure if contents of stim are the character strings as valid numbers that v=zeros(size(stim)); for idx=1:length(stim) v(idx)=str2num(stim{idx}); end will work as intended. However, as I noted earlier, w/ cellfun and later version than I have, there's probably a better way as us has shown. --
From: Faraz Afzal on 10 Jul 2010 20:23 dpb <none(a)non.net> wrote in message <i1b1tb$inn$1(a)news.eternal-september.org>... > Alessandra wrote: > ... > > > and if I run your script I get this error: > > > >>> s={stim}; > >>> v=zeros(size(s)); > > for idx=1:length(s), v(idx)=str2num(s{idx});end > > ??? Error using ==> str2num at 33 > > Requires string or character array input. > ... > > Well, I presumed you would have the common sense to use your cell array > instead of just blindly copying a quickie keyboard demonstration... :( > > I'm quite sure if contents of stim are the character strings as valid > numbers that > > v=zeros(size(stim)); > for idx=1:length(stim) > v(idx)=str2num(stim{idx}); > end > > will work as intended. > > However, as I noted earlier, w/ cellfun and later version than I have, > there's probably a better way as us has shown. > > -- Well I wonder why you people started insulting someone who made a mistake.. Were you guys never making mistakes.. Its of my no concern but I would just say You,me and all of US here are to help each other, then help if its of concern else leave it.. I am sorry I just hated the attitude of the perfect guys here.. Regards, Faraz
From: us on 10 Jul 2010 20:34 "Faraz Afzal" > Well I wonder why you people started insulting someone who made a mistake.. Were you guys never making mistakes.. Its of my no concern but I would just say You,me and all of US here are to help each other, then help if its of concern else leave it.. > > I am sorry I just hated the attitude of the perfect guys here.. > > Regards, > Faraz well... YOU obviously have not wasted YOUR time to (even try to) come up with a solution... words are cheap - yet ML code is better... ....and i have not seen YOU come up with a single line of ML language... us
From: Faraz Afzal on 10 Jul 2010 20:50 "us " <us(a)neurol.unizh.ch> wrote in message <i1b3ht$a1p$1(a)fred.mathworks.com>... > "Faraz Afzal" > > Well I wonder why you people started insulting someone who made a mistake.. Were you guys never making mistakes.. Its of my no concern but I would just say You,me and all of US here are to help each other, then help if its of concern else leave it.. > > > > I am sorry I just hated the attitude of the perfect guys here.. > > > > Regards, > > Faraz > > well... > YOU obviously have not wasted YOUR time to (even try to) come up with a solution... > words are cheap - yet ML code is better... > ...and i have not seen YOU come up with a single line of ML language... > > us :)) Much expected proudy behavior.. 'us' u rock !!! :))) hatss off !!! Regards, Faraz
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 4 Prev: Reading Serial data through Simulink Input Packet Next: remove duplicate rows in sparse matrix |