Matrix Dimensions must agree GUI
1 view (last 30 days)
Show older comments
I am creating a projectile motion GUI. I keep running into Matrix dimesion must agree for x and y values.
theta=app.ThetaEditField.Value;
v0=app.InitialVelocityEditField.Value;
g=9.81;
ax=0;
ay=-g;
vix=v0*cosd(theta);
viy=v0*sind(theta);
vfx=vix;
vfy=-viy;
t=(vfy-viy)/ay;
t2 = 0 : t/100 : t*2;
x=vfx.*t2+(1/2)*ax.*t2.^2;
y=viy.*(t2./2)+(1/2)*(ay).*(t2./2).^2 ;
1 Comment
VBBV
on 3 Dec 2020
It could also be possible if you are using theta and v0 variables elsewhere in your GUI functions
Use
clear theta v0
variables before using them in GUI function
Are you trying to enter theta and v0 as vectors ? or scalar
Answers (0)
See Also
Categories
Find more on Migrate GUIDE Apps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!