Search All of the Math Forum:

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

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

 Messages: [ Previous | Next ]
 dpb Posts: 9,850 Registered: 6/7/07
Re: Combine string matrix and integer matrix
Posted: Aug 25, 2013 9:11 AM

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

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.

--

Date Subject Author
8/23/13 John Dickson
8/23/13 Saravanan Mani
8/23/13 John Dickson
8/23/13 dpb
8/23/13 John Dickson
8/24/13 dpb
8/25/13 John Dickson
8/25/13 dpb