Does syntax checking support undefined variables?

1 Ansicht (letzte 30 Tage)
bing zhu
bing zhu am 7 Dez. 2022
Kommentiert: bing zhu am 7 Dez. 2022
Does matlab support undefined variables like pycharm(fig 1)?The system and software are as follows:window10,matlab r2022b.

Antworten (1)

Hiro Yoshino
Hiro Yoshino am 7 Dez. 2022
Bearbeitet: Hiro Yoshino am 7 Dez. 2022
MATALB automatically identifies problems. Debugging features help you diagnose specific issues, see as follows :
I suppose this function is active by default though.
  4 Kommentare
Hiro Yoshino
Hiro Yoshino am 7 Dez. 2022
Bearbeitet: Hiro Yoshino am 7 Dez. 2022
Sorry, I took it wrong. Let me put it this way....: No, but the problem identifier is "on" by default.
The trouble is that MATLAB never knows if the variable "b" exists in your workspace. So this syntax can be wrong and can be right dependiong on the situation.
For example, you may run a simulation using Simulink models and export something as a variable that would not exist without a run of the simulation. An automatic analysis will be perfomed, once the simulation is over. Your variable "b" is used in the script of this automatic analysis
So this is not a "bug" but a feature.
You can check if your variables exist in the workspace by the method like this.
bing zhu
bing zhu am 7 Dez. 2022
Thanks for your response

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Programmatic Model Editing finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by