The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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 ]

Posts: 9,850
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]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.