Aerobalence Code , how do i get the code to output just 1 answer
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
clear
clc
front=0; % initialise front variable
rear=0;
AeroBalence=readmatrix("aerobalence.xlsx");
m=size(AeroBalence); % find the size of the matrix AeroBalence
RH_F=AeroBalence(2:m(1),1); % Front ride height matrix
RH_R = AeroBalence(1,2:m(2)); % REAR ride height matrix
AB=AeroBalence(2:m(1),2:m(2)); % AeroBalence %
while front<RH_F(1,1) || front>RH_F(7,1)
prompt = strcat('insert a front ride height larger than', num2str(RH_F(1,1)));
front = input(prompt);
end
while rear<RH_R(1,1) || rear>RH_R(1,7)
prompt1 = strcat('insert a rear ride height larger than', num2str(RH_R(1,1)));
rear = input(prompt1);
end
for i=1:size(RH_F)-1
min_front=RH_F(i,1);
max_front=RH_F(i+1,1);
if front>= min_front && front < max_front
for j=1:7
newAeroBalence(j)= AB(i,j)+(AB(i+1,j)-AB(i,j))*((front-min_front)/(max_front-min_front))
end
elseif front==max_front
newAeroBalence(:)=AB(i+1,:)
end
end
this is the code im using , matlab is not my strong point and im wondering how you can get the code to output just 1 answer instead of 7. how do i get the code to pick a rear ride height to give out 1 conclusive answer thanks
2 commentaires
Réponses (1)
Asvin Kumar
le 20 Mai 2021
The 7 outputs are because you have an assignment statement inside a for loop that runs 7 times. You are not suppressing the output. Use a semicolon at the end to suppress output. For example:
a=7 % prints output
a=7; % doesn't print output
As to what you want printed out, I'm not sure because I don't have context for the algorithm in the code.
0 commentaires
Voir également
Catégories
En savoir plus sur Logical dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!