Transposing cell arrays is behaving like cellfun

1 view (last 30 days)
I was having some strange errors, and eventually figured out that this was going on. Take a simple example.
a = cell(1, 2)
a{1} = 'wx'
a{2} = 'yz'
Now, let's transpose.
EDU>> aT = a'
aT =
[2x1 char] [2x1 char]
EDU>> size(aT)
ans =
1 2
EDU>> size(a)
ans =
1 2
EDU>> aT{1}
ans =
w
x
Isn't this weird? Did I change some setting or something that is messing this up?

Accepted Answer

the cyclist
the cyclist on 19 Nov 2014
That's not what I get. I get that aT is a 2x1 cell array, as you expected.
Could you have somehow redefined the ctranspose function, which is what the "apostrophe" calls? What you do you get when you type
which -all ctranspose
?
  1 Comment
John
John on 19 Nov 2014
Absolutely right! A third-party library contained a function called ctranspose which caused the incorrect behavior. After removing it, things worked again. Thanks!

Sign in to comment.

More Answers (0)

Categories

Find more on Structures in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!