cell array into matrix

3 次查看(过去 30 天)
NIKHIL MC2023-3-15
评论: Dyuman Joshi ,2023-3-15
i want to convert a cell array having different number of rows into a matrix. I tried different ways but couldnt get the exact solution
for j1=1:m1
[pks{j1},fa{j1}] = findpeaks(z1(1:end,j1));
[pks1{j1},fr{j1}] = findpeaks(-z1(1:end,j1));
  1 个评论
Dyuman Joshi
Dyuman Joshi 2023-3-15
Do you mean different number of columns?
You can not concatenate rows/columns having inconsistent dimensions to obtain a numeric matrix.
y={[1 2];[3 4 5]};
Error using cat
Dimensions of arrays being concatenated are not consistent.
You might have to pad the rows/columns with NaN or any other value.


回答(1 个)

KSSV 2023-3-15
Read about cell2mat.


Find more on Operators and Elementary Operations 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!

Translated by