Preventing unwanted variables being saved in .mat file
1 次查看(过去 30 天)
显示 更早的评论
Hi there,
I am using the code below to create a .mat file.
In the .mat file it is saving
- fn
- k
- nrows
- sch_cycle
- sch_grade
- sch_key_on
- sch_metadata
- x
How could I make it only save these only?
- sch_cycle
- sch_grade
- sch_key_on
- sch_metadata
x = cellstr(ls('*.xls'));
for k = 1:length(x)
sch_cycle=xlsread('C:\Autonomie practice\cycle.xls','Input_data');
nrows = size(sch_cycle,1);
sch_grade=[0,0;nrows,0];
nrows = size(sch_cycle,1);
sch_grade=[0 0;nrows 0];
sch_key_on=[0 1; nrows 1];
[~,fn] = fileparts(x{k});
sch_metadata.name = fn;
sch_metadata.proprietary='public';
save([fn,'.mat']);
end
Thank you
0 个评论
采纳的回答
Jonathan Sullivan
2012-3-16
save([fn,'.mat'],'sch_cycle','sch_grade',sch_key_on','sch_metadata');
help save
doc save
3 个评论
更多回答(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!