Reputation: 131
this problem is very annoying. The situation is like this, I am having .mat file with only a single variable in it. I am interesting in loading it in another variable without accessing the variable from the file tha t I am trying to load. Right, now I have tried something like this but with no effect:
A=[];
details=whos(FileName);
aux=load(FileName,upper(details.name);
A=aux.(details.name);
Upvotes: 1
Views: 452
Reputation: 14947
Since your MAT file has only one variable in it, you can load the whole thing and extract the name you want from there:
aux=load(FileName);
names=fieldnames(aux);
A=aux.(names{1});
Upvotes: 3