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

9 次查看(过去 30 天)
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".

采纳的回答

Walter Roberson
Walter Roberson 2024-10-16
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 个评论
Walter Roberson
Walter Roberson 2024-10-21
移动:Voss 2024-10-21
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 2024-10-22
移动:Voss 2024-10-22
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);

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 General Applications 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by