MATLAB Answers

convert matrix into cell

5 views (last 30 days)
How to convert selected motors into a cell but making the cell size 3x1 with the same values? in other words row 1 in cell will have 13161501100001,.....
  1 Comment
Guillaume
Guillaume on 18 Apr 2016
What do you call a cell? There's no such thing in matlab's vocabulary.
There are cell arrays. Is that what you want? In which case, see Star's answer but you're probably better off keeping your selected_motors as it is, as a vector of numbers.
If it's the class of the data, int64, that is a problem, then please state that.

Sign in to comment.

Accepted Answer

Azzi Abdelmalek
Azzi Abdelmalek on 18 Apr 2016
a=int64(1:3)';
out=num2cell(a)

More Answers (1)

Rajesh Dubal
Rajesh Dubal on 18 Apr 2016
Edited: Rajesh Dubal on 19 Apr 2016
See help on cell2mat.
d=[1;2;3];
e=mat2cell(d);
Will create a variable 'e' which has the values 1,2,3 as contents of a cell
  2 Comments
Rajesh Dubal
Rajesh Dubal on 19 Apr 2016
Thank you for the information, I have made appropriate changes now

Sign in to comment.

Tags

Community Treasure Hunt

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

Start Hunting!