Reputation: 95
I am analyzing some data and I need to load the information from a file. I wrote a script which contains the following line:
load('../Psychopy/DataPrueba/Estefi_1_datos.mat');
I'm wondering if there's anyway to write something like:
Name=Estefi;
load('../Psychopy/DataPrueba/Name_1_datos.mat');
Because it's data from an experiment, I have to do with 40 people at least and that little change in the script would automatize my work quite a lot.
Upvotes: 0
Views: 755
Reputation: 7925
You can do it like this:
Name='Estefi';
load(['../Psychopy/DataPrueba/',Name,'_1_datos.mat']);
Two things to note:
Name
has to be a string (use '
) []
) around the combination of strings and your variable.Upvotes: 1