How to read and save different variables in a matfile to another mat file
조회 수: 2 (최근 30일)
이전 댓글 표시
How to read two specific variables from a .mat file having different variables and save it to another .mat file without changing the variable name.
댓글 수: 0
채택된 답변
Stephen23
2018년 9월 21일
편집: Stephen23
2018년 9월 21일
S = load('file1.mat','var1','var2');
save('file2.mat','-struct','S')
OR
S = load('file1.mat');
save('file2.mat','-struct','S','var1','var2')
댓글 수: 5
Stephen23
2018년 9월 24일
@sachin k p: if the names are different then you could try the '-append' option, like this:
S = load('file1.mat','var1','var2');
save('file2.mat','-struct','S','-append')
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!