Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Combine string matrix and integer matrix
Replies: 7   Last Post: Aug 25, 2013 9:11 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
dpb

Posts: 8,217
Registered: 6/7/07
Re: Combine string matrix and integer matrix
Posted: Aug 25, 2013 9:11 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 8/25/2013 3:37 AM, Sincloe Brans wrote:
> Wow... Excellent work! That does look good!
> Appreciate your help mate!


I intended to do one other perturbation to show the difference between a
cell of a character array and a cell array of strings...

>> c=cellstr([num2str(A) repmat(' ',size(A,1),1) char(B)])
c =
'1 3 4 4 a b c'
'3 3 4 5 a a a'
'4 4 5 5 a c a'
'5 4 4 5 a b c'
>> c(1)
ans =
'1 3 4 4 a b c'
>> c{1}
ans =
1 3 4 4 a b c
>>

I presume the first two above is where you were seeing the single
quotes. But that's using either the whole array reference or standard
parens which refer to the cell. The content of the cell is obtained by
using the curly braces to dereference it as the last shows. This is
generally the most convenient downstream as it returns the full
character array w/ one subscript expression instead of having to write
the trailing ',:' for the basic character array.

--



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.