Reputation: 382
I have a cell array in MATLAB, say A{1}
, A{2}
, A{3}
,...., A{561}
.
I want pass it to a function argument like:
horzcat(A{1}, A{2}, ..., A{561})
Obviously, it is a lethargic way to write all the cells. What is the shortcut way to do it?
I have already tried horzcat(A{1}:A{561})
but it is not working.
Upvotes: 5
Views: 746
Reputation: 19689
Convert your cell array A
into a comma-separated list using A{:}
and then pass it as a function input argument e.g.
horzcat(A{:})
Upvotes: 6