필터 지우기
필터 지우기

Concatenating a 3D matrix in the 3rd dimension when some cells are empty

조회 수: 3 (최근 30일)
I have a 3D cell array 'A' of size 120 x 180 x 365 (latitude, longitude, day of year).
If I call up a single cell (e.g. A(1,1,1)), this opens matrix 'B' which has two columns (vessel identity, speed), but the number of rows varies by cell. Some cells do not contain any data and display [ ] instead of a B matrix.
I need to make one B matrix that displays all the vessel identities and speeds for A(1,1,1:365)
How can I vertically concatenate matrix B in the third dimension?
Thank you for your help.

채택된 답변

Jos (10584)
Jos (10584) 2019년 3월 8일
B = cat(1,A{1,1,1,:}) % N-by-2 array
  댓글 수: 7
Walter Roberson
Walter Roberson 2019년 3월 13일
You said that opening up a single element A(1,1,1) results in a B matrix with two columns. But A{1,1,1} is returning a 1 x 18 cell array. There is a contradiction here.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by