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: why does a cell look different when it is a field in a struct?
Replies: 2   Last Post: Dec 5, 2012 1:49 PM

Advanced Search

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

Posts: 5,646
Registered: 2/7/05
why does a cell look different when it is a field in a struct?
Posted: Dec 5, 2012 8:02 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Matlab 2012a

I am not good with cells. but this is strange:

---------------------
clear all;
A = {'A' 'a';'B' 'c'};
s = struct('data',{A(:,1)'});
------------------------

Now I typed:

-----------------
r1 = {A(:,1)'}
r2 = s.data
-----------------

Isn't the above 2 variable supposed to contain the same thing?

But see:

---------------------
r1 =
{1x2 cell}


r2 =
'A' 'B'
---------------------

I am confused now. Why are they different?

--Nasser



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.