Prev: matlab compiler error mbuild -setup
Next: use imagesc function but change only background as black.
From: jens on 3 Feb 2010 14:35 Hello Matlab users Example: If I have a vector like countvector: countvector=[] countvector=[ countvector 1] countvector=[ countvector 2] Is there anyway to make a cellarray that do the same with strings like 'string1', 'string2 ', 'string3'........Instead of numeric data in a vector like the countvector? Best Regards Jens
From: Matt J on 3 Feb 2010 14:45 "jens " <storebonghoved(a)hotmail.com> wrote in message <hkcj5p$m3i$1(a)fred.mathworks.com>... > Is there anyway to make a cellarray that do the same with strings like 'string1', 'string2 ', 'string3'........Instead of numeric data in a vector like the countvector? ================ Yes, although in both cases the practice is strongly discouraged (you should preallocate your arrays) >> stringcell={}; >> stringcell=[stringcell {'string1'}], stringcell = 'string1' >> stringcell=[stringcell {'string2'}], stringcell = 'string1' 'string2'
From: Matt J on 3 Feb 2010 15:44 "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hkcjog$slj$1(a)fred.mathworks.com>... > >> stringcell={}; > >> stringcell=[stringcell {'string1'}], > > stringcell = > > 'string1' > > >> stringcell=[stringcell {'string2'}], > > stringcell = > > 'string1' 'string2' =============================== In fact, you don't even need to use braces: >> stringcell={}; >> stringcell=[stringcell 'string1'], stringcell = 'string1' >> stringcell=[stringcell 'string2'], stringcell = 'string1' 'string2'
From: jens on 4 Feb 2010 02:48 "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hkcn6n$7ml$1(a)fred.mathworks.com>... > "Matt J " <mattjacREMOVE(a)THISieee.spam> wrote in message <hkcjog$slj$1(a)fred.mathworks.com>... > > > >> stringcell={}; > > >> stringcell=[stringcell {'string1'}], > > > > stringcell = > > > > 'string1' > > > > >> stringcell=[stringcell {'string2'}], > > > > stringcell = > > > > 'string1' 'string2' > =============================== > > In fact, you don't even need to use braces: > > > >> stringcell={}; > >> stringcell=[stringcell 'string1'], > > stringcell = > > 'string1' > > >> stringcell=[stringcell 'string2'], > > stringcell = > > 'string1' 'string2' Thank you very much Matt Best Regards Jens
|
Pages: 1 Prev: matlab compiler error mbuild -setup Next: use imagesc function but change only background as black. |