A plot command does not work in a newer version of MATLAB
Afficher commentaires plus anciens
So I'm trying to recreate an old project done by my professor and I'm stuck at this part:
plot(Uprav(:,1), Uprav(:,2));
This piece of code outputs an error "Undefined function or variable 'Uprav'". Even though, I added the variable name in the Logging tab of the Properties of Scope block. The version of MATLAB where the code worked remains unknown. Could you explain to me what is this piece of code supposed to do and suggest me an alternative. Thanks in advance!
Tested versions: R2021a, R2017a
Réponses (1)
Walter Roberson
le 10 Avr 2023
0 votes
The problem is not with plot(): the problem is not finding Uprav .
The line of code you are using can only exist in Simulink inside a MATLAB Function Block; in such a case you would need to have the variable as a signal that is input to the MATLAB Function Block.
I suspect from your discussion of logging, that what is happening is that you have configured the model for the newer single output system, but that it was designed for use with the older output system. I suspect that you have some MATLAB code that is calling sim() and is then assuming that the simulink model wrote the variable into the workspace of the MATLAB code through the output argument process (that is, it does not sound like you are using a To Workspace block).
If I am right then potentially converting back to the older output system would work -- but it would be "better" to stay with the newer single output system and access the data from the unified output; see https://www.mathworks.com/help/simulink/slref/simulink.simulationoutput.html
Catégories
En savoir plus sur Simulink dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!