Error: Attempt to add (variable) to a static workspace,

33 visualizzazioni (ultimi 30 giorni)
My function
function Densite
load x;
load h
if ...........................
.................
elseif ........................
........................
end
end
error
Error using ===> load
Attempt to add "x" to static workspace
Errr in ===> Densite
load x;

Risposta accettata

Max Murphy
Max Murphy il 31 Dic 2019
Try
function Densite
% load x;
% load h
in = load('x.mat','x'); % If these were together in one file, like 'data.mat'
x = in.x; % then you could load both at once
in = load('h.mat','h');
h = in.h;
if ...........................
.................
elseif ........................
........................
end
end
error
Error using ===> load
Attempt to add "x" to static workspace
Errr in ===> Densite
load x;

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by