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 ?

采纳的回答

Walter Roberson
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 CenterFile Exchange 中查找有关 Workspace Variables and MAT-Files 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by