cell array into matrix

2 Ansichten (letzte 30 Tage)
NIKHIL MC
NIKHIL MC am 15 Mär. 2023
Kommentiert: Dyuman Joshi am 15 Mär. 2023
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));
end
  1 Kommentar
Dyuman Joshi
Dyuman Joshi am 15 Mär. 2023
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]};
cat(1,y{:})
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.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

KSSV
KSSV am 15 Mär. 2023
Read about cell2mat.

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by