include all rows matrix in []
조회 수: 4 (최근 30일)
이전 댓글 표시
>> size(z)
ans =
5668 73
BB=[z(:,1),z(:,2),z(:,3)....z(:,73]
i need in [] include all rows z
how can i do it?
댓글 수: 2
Paul
2023년 6월 5일
Are you sure the problem is stated correctly? As written, BB will be the same as z.
Here's a small example:
z = rand(2,3)
BB = [z(:,1),z(:,2),z(:,3)]
채택된 답변
Walter Roberson
2023년 6월 5일
zc = num2cell(z,1); %1 --> preserve first dimension
[Sis.h] = zc{:}; %or [Sis.h] = deal(zc{:});
댓글 수: 0
추가 답변 (1개)
Paul
2023년 6월 5일
편집: Paul
2023년 6월 5일
One way ....
Create example data
Sis.a = 1;
Sis = repmat(Sis,73,1);
z = rand(5668,73);
The code
[Sis.z] = cell2struct(num2cell(z,1),'z',1).z;
Verify
isequal([Sis.z],z)
댓글 수: 1
Walter Roberson
2023년 6월 5일
Sis.a = 1;
Sis = repmat(Sis,73,1);
z = rand(5668,73);
[Sis.z] = struct('z', num2cell(z,1)).z;
isequal([Sis.z],z)
참고 항목
카테고리
Help Center 및 File Exchange에서 Animation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!