Compare on plots variables from two .mat files with same variables

8 views (last 30 days)
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 ?

Accepted Answer

Walter Roberson
Walter Roberson on 22 Jan 2021
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.

More Answers (0)

Tags

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!