MATLAB Answers

Covert cell array to array

1 view (last 30 days)
Mo H
Mo H on 3 Apr 2020
Commented: Mo H on 3 Apr 2020
Hello,
I have some data stored in a cell array and the size the cell is not known. I want to convert the cell array into array.
Basically, I want to create a for loop that reads the the previous array in the cell, determine it it size, and then store the data in array.
For example,
CellArrar = {[1 5 7;2 6 8],[1 5 8; 2 5 7],[1 8 8]}
Array = [ 1 5 7; 2 6 8;3 5 8; 4 5 7;5 8 8]
Thank you a lot

  0 Comments

Sign in to comment.

Accepted Answer

Birdman
Birdman on 3 Apr 2020
Something like this?
Array=cell2mat(CellArrar.')

  3 Comments

Mo H
Mo H on 3 Apr 2020
How to fix the sequential numbers in the first column
Birdman
Birdman on 3 Apr 2020
Array(:,1)=1:size(Array,1)
Mo H
Mo H on 3 Apr 2020
Thank you

Sign in to comment.

More Answers (0)

Tags