Compare on plots variables from two .mat files with same variables
8 次查看(过去 30 天)
显示 更早的评论
I would like to compare (by plot) variables of two .mat files but the two files contain the same variable names. So I cannot simply load the two files. Do I have to rename manually the variables of each file, or is there a mean to differentiate from which file a variable come from ?
0 个评论
采纳的回答
Walter Roberson
2021-1-22
f1 = load('FirstName.mat');
f2 = load('SecondName.mat');
plot(f1.X, f1.Y, 'b', f2.X, f2.Y, 'k--'); legend({'first file', 'second file'})
Use the function form of load(), which will create a struct with one field for each variable name.
更多回答(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!