Save part of a big matrix to *.mat of another name
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi,
Now I have a 3D matrix: abc = rand(2,3,3); I want to save only the second layer of the matrix abc(2,:,:) to the workspace, with the name of, e.g. new.mat
Matlab accepts the following code: save('new.mat', 'abc')
But not save('new.mat', 'abc(2,:,:)')
What should I do? any suggestion is appreciated!
댓글 수: 0
답변 (1개)
Azzi Abdelmalek
2012년 10월 18일
abc = rand(2,3,3);
abc2=abc(2,:,:)
save('new.mat', 'abc2')
댓글 수: 2
Azzi Abdelmalek
2012년 10월 18일
I suggest
abc = rand(2,3,3);
abc2=abc(2,:,:)
abc(2,:,:)=[]
save('new.mat', 'abc2')
or if you don't need abc
clear abc % just before saving abc2
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!