From: Jose on 28 Jun 2010 12:50 Hello guys, i am interested to write down a variable with strings + numbers... a=[2 3 4] channela(1)=1;....i.e channel1 channela(2)=2;...i.e channel2 channela(3)=3;...i.echannel3 How can convert a(1) in string...i suppose is with the command num2str, but how it works to get channel1? Thanks,
From: us on 28 Jun 2010 12:58 "Jose " <jose.l.vega(a)gmail.com> wrote in message <i0ajsp$6t5$1(a)fred.mathworks.com>... > Hello guys, i am interested to write down a variable with strings + numbers... > > a=[2 3 4] > > channela(1)=1;....i.e channel1 > > channela(2)=2;...i.e channel2 > > channela(3)=3;...i.echannel3 > > How can convert a(1) in string...i suppose is with the command num2str, but how it > works to get channel1? > > Thanks, a hint: - do NOT do it... http://matlabwiki.mathworks.com/MATLAB_FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F us
From: Jose on 28 Jun 2010 13:19 Thanks us. "us " <us(a)neurol.unizh.ch> wrote in message <i0akav$81m$1(a)fred.mathworks.com>... > "Jose " <jose.l.vega(a)gmail.com> wrote in message <i0ajsp$6t5$1(a)fred.mathworks.com>... > > Hello guys, i am interested to write down a variable with strings + numbers... > > > > a=[2 3 4] > > > > channela(1)=1;....i.e channel1 > > > > channela(2)=2;...i.e channel2 > > > > channela(3)=3;...i.echannel3 > > > > How can convert a(1) in string...i suppose is with the command num2str, but how it > > works to get channel1? > > > > Thanks, > > a hint: > - do NOT do it... > > http://matlabwiki.mathworks.com/MATLAB_FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F > > us
From: Jose on 28 Jun 2010 13:29 Sorry us, but it does not work with eval and sprintf when iI have this kind of variable proc1m...i am interested to supply 1 for a(x), where a=[2 3 4]... something like that: sprintf('proc%dm', a(1))); does not work... Any help? proc1m=uicontrol('parent',hfigure{i},'String', num2str(panel(i)),... 'Position', [240,400,60,20]); "Jose " <jose.l.vega(a)gmail.com> wrote in message <i0ajsp$6t5$1(a)fred.mathworks.com>... > Hello guys, i am interested to write down a variable with strings + numbers... > > a=[2 3 4] > > channela(1)=1;....i.e channel1 > > channela(2)=2;...i.e channel2 > > channela(3)=3;...i.echannel3 > > How can convert a(1) in string...i suppose is with the command num2str, but how it > works to get channel1? > > Thanks,
From: us on 28 Jun 2010 13:44 "Jose " <jose.l.vega(a)gmail.com> wrote in message <i0am57$96k$1(a)fred.mathworks.com>... > Sorry us, > but it does not work with eval and sprintf when iI have this kind > of variable proc1m...i am interested to supply 1 for a(x), where a=[2 3 4]... > something like that: > > sprintf('proc%dm', a(1))); does not work... > > > Any help? > > proc1m=uicontrol('parent',hfigure{i},'String', num2str(panel(i)),... > 'Position', [240,400,60,20]); this is NOT what the faq suggests... in your case, a CSSMer typically would do something like this proc=nan(N,1); % <- preallocation... a=[...]; for i=1:N ... proc(a(i),1)=uicontrol(...); % <- UICONTROLs return DOUBLEs... ... end us
|
Next
|
Last
Pages: 1 2 3 4 Prev: plotting colors Next: Read Image from RAW (image data before demosaicking) |