Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

Calling script within method fails

2 vues (au cours des 30 derniers jours)
Daniel H
Daniel H le 12 Mar 2015
Clôturé : MATLAB Answer Bot le 20 Août 2021
Hi,
I have a method which calls an external script. Example.
../../script.m:
ret = 1000;
The method looks as follows:
methods
function value = CalculateEntry(this)
run('../../script.m');
value = ret;
end
end
However, I get
??? Error using ==> CalculateEntry
Output argument "value" (and maybe others) not assigned during call to
...
When I debug the program I see that script.m is executed and "ret" is assigned. However, when "run" returns to "CalculateEntry", "ret" is suddenly NaN.
How to fix this?
  1 commentaire
Guillaume
Guillaume le 12 Mar 2015
Why not convert the script into a function. It'll probably solve your problem and would be cleaner anyway as it's then clear what the inputs and outputs are

Réponses (1)

Daniel H
Daniel H le 12 Mar 2015
Indeed, I had a type (instead "ret" I used "I0" in my code but accidentially used "IO"...)

Cette question est clôturée.

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by