필터 지우기
필터 지우기

Create a non-rectangular array

조회 수: 10 (최근 30일)
Michael
Michael 2014년 2월 21일
댓글: Sunetra CV 2019년 11월 13일
Hi
I have several vectors of different lengths and I'd like to save these in one common variable. Let's say, one vector per row, but with different number of cols per row. Is there a way to do so or do I have to store them in a rectangular matrix and just fill up the rows by zeros?
Best regards Michael

채택된 답변

Mischa Kim
Mischa Kim 2014년 2월 21일
편집: Mischa Kim 2014년 2월 21일
Michael, have a look at cell arrays:
c = {[1];
[2, 3, 4];
[5, 9];
[6, 7, 8, 10, 11, 12]};
c{2}
ans =
2 3 4
  댓글 수: 2
Michael
Michael 2014년 2월 21일
I already tried this, but I made a mistake with [] and {}, so it didn't work and I assumed that cell arrays don't support this at all. But now I see how I have to do it correctly, thanks! :-)
Sunetra CV
Sunetra CV 2019년 11월 13일
Is it possible to call only certain values from the subset of c?

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

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by