error in calling a variable from another mat file
Mostra commenti meno recenti
after doing some coding I have run a loop and saved values in cell R
for r=1:En
R{r} =E(Ec+Ea(r,:),:);
end
I have saved a variable of cell in a matfile named
save('data_12x6','R')
where 'data_12x6' is fle name and 'R'is variable . now I want to call this variable in the below code
for r=1:numel(R)
X=(R{r}*x).*y';
XX(r)=(sum(X))*0.01;
end
I an trying this
R=load('data_12x6','R')
for r=1:numel(R)
X=(R{r}*x).*y';
XX(r)=(sum(X))*0.01;
end
but it is giving an error that
Warning: Variable 'R' not found.
R =
struct with no fields.
Cell contents reference from a
non-cell array object.
how can I do this?
3 Commenti
Jan
il 28 Gen 2017
While the code to create R does not matter here, the command for saving would be important. Please post this detail.
Walter Roberson
il 28 Gen 2017
R=load('data_12x6','R')
would always give back a struct in that form of load(). There are forms of load() that return back values instead of a struct, but you cannot request particular variables when you use them.
The warning is telling you that it did not find a variable R inside data_12x6.mat
Walter Roberson
il 29 Gen 2017
Please show the output of
whos -file data_12x6
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Workspace Variables and MAT Files in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!