cell array into matrix

조회 수: 2 (최근 30일)
NIKHIL MC
NIKHIL MC 2023년 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));
end
  댓글 수: 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]};
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

KSSV
KSSV 2023년 3월 15일
Read about cell2mat.

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by