I need help to figure out why these variables aren't being found.

11 Ansichten (letzte 30 Tage)
DJ V
DJ V am 16 Okt. 2024
Verschoben: Voss am 22 Okt. 2024 um 18:05
I have written simulink code that is to produce variables that later are to be read into Matlab. Unfortunately, Matlab interprets those variables using the following errors:
>> EqnsOfMotionback
Warning: Variable 'pn' not found.
> In EqnsOfMotionback (line 95)
Warning: Variable 'pe' not found.
> In EqnsOfMotionback (line 96)
Warning: Variable 'pd' not found.
> In EqnsOfMotionback (line 97)
Warning: Variable 'phi' not found.
> In EqnsOfMotionback (line 98)
Warning: Variable 'psi' not found.
> In EqnsOfMotionback (line 99)
Warning: Variable 'theta' not found.
> In EqnsOfMotionback (line 100)
Why are all these variables not being found? I put them in a specific directory on purpose. I don't want to leave it to a computer's whim or some vaguely known "rule".

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 16 Okt. 2024
load("C:\Users\1537268928E\OneDrive - United States Air Force\Desktop\Pn.mat","pn");
load("C:\Users\1537268928E\OneDrive - United States Air Force\Desktop\Pe.mat","pe");
load("C:\Users\1537268928E\OneDrive - United States Air Force\Desktop\Pd.mat","pd");
load("C:\Users\1537268928E\OneDrive - United States Air Force\Desktop\phi.mat","phi");
load("C:\Users\1537268928E\OneDrive - United States Air Force\Desktop\psi.mat","psi");
load("C:\Users\1537268928E\OneDrive - United States Air Force\Desktop\theta.mat","theta");
The warning messages are telling you that pn is not being found in Pn.mat, and pe is not being found in Pe.mat and so on.
Possibly the variables are named Pn and Pe in the .mat files.
  20 Kommentare
Walter Roberson
Walter Roberson am 21 Okt. 2024
Verschoben: Voss am 21 Okt. 2024
There is an implicit "1" to start with. The 1 is multiplied by the inputs that are marked as multiplication, and is divided by inputs that are marked as division. For example you could have two divisions A and B, and that would be (1/A) * (1/B)
DJ V
DJ V am 22 Okt. 2024 um 18:02
Verschoben: Voss am 22 Okt. 2024 um 18:05
Now, more fun. I'm trying to control the direction of motion of the aircraft, but it seem that when I do this, I move it off the screen instantly. The errors it is outputting are as follows:
Error using matlab.graphics.chart.primitive.Line/set
Invalid or deleted object.
Error in EqnsOfMotionback>drawPlaneBody (line 166)
set(handle, 'XData', XYZ(1,:), 'YData',XYZ(2,:), 'ZData',XYZ(3,:));
Error in EqnsOfMotionback (line 117)
handle =
drawPlaneBody(pn(k),pe(k),pd(k),phi(k),theta(k),psi(k),handle);

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu General Applications finden Sie in Help Center und File Exchange

Produkte


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by