Save part of a big matrix to *.mat of another name
1 回表示 (過去 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!