# How can i convert this flowchart to write matlab code? and how can i call an excel data (for prices example)to code

20 Ansichten (letzte 30 Tage)
NN am 20 Aug. 2020
Kommentiert: Rik am 5 Jun. 2021
can someone help to write matlab code the attached flowchart ? ##### 1 KommentarKeine anzeigenKeine ausblenden
Rik am 20 Aug. 2020

Melden Sie sich an, um zu kommentieren.

### Antworten (2)

Jalaj Gambhir am 24 Aug. 2020
Hi,
I am assuming you want to know how to read data from excel files in your code. You can do so using readtable. You might find examples from this link useful.
Also, if you have any "specific" doubts in the implementation of the algorithm from the given flowchart, you can let us know
Hope this helps!
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

Naven Raj am 5 Jun. 2021   This is my flowchart.
I have tried doing the coding. I have mention the coding below. Its showing error most of the time. Can someone help myself to rectify the coding
% This program is to assign the Stability and Determinacy of Structure Beam
% and Truss
function main()
% Gethering input
Structure = input("Choose your structure '1-2': ",'s');
while Structure == '1'
r = input("Enter number of reaction: ");
n = input("Enter number of internal hinge: ");
X= n + 3;
if r < X
Beam = 'Statistical Unstable';
elseif r == X
Beam = 'Determinate';
elseif r > X
Beam = 'Indeterminate';
end
fprintf ("\n");
fprintf("\n\n");
if Beam == "Indeterminate"
r= input("Enter number of reaction : ");
n= input("Enter number of internal hinge: ");
end
Degree=r-(n+3);
Degree=round(Degree,1);
fprintf("\n\n");
fprintf("Your degree of determinacy is %f\n",Degree);
fprintf("\n\n");
Selection=input("Would you like to continue?\n(please type Yes or No): ");
if Selection=="Yes"
main()
else
if Selection=="No"
fprintf("Thank you and have a nice day");
return;
elseif Beam=='Determinate'
end
fprintf("\n\n");
fprintf("**********Assumed clockwise from the left point**********");
fprintf("\n\n");
F=input("Enter force value(kN):");
RB=F/2;
RB=round(RB,2);
RA=F-RB;
RA=round(RA,2);
fprintf("\n\n");
fprintf("Your RA is %.2fkN and RB is %.2fkN",RA,RB);
fprintf("\n\n");
Selection=input("Would you like to continue?\n(please type Yes or No): ",'s');
if Selection=="Yes"
main();
else
if Selection=="No"
fprintf("Thank you and have a nice day");
return;
end
end
end
fprintf("**********Assumed clockwise from the left point**********");
fprintf("\n\n");
F=input("Enter force value(kN) :");
L=input("Enter length value(m) :");
x=input("Enter distance value near to the left point(m):");
RB=(F*x)/L;
RB=round(RB,2);
RA=F-RB;
RA=round(RA,2);
fprintf("\n\n");
fprintf("Your RA is %.2fkN and RB is %.2fkN",RA,RB);
fprintf("\n\n");
Selection=input("Would you like to continue?\n(please type Yes or No): ",'s');
if Selection=="Yes"
main()
else
if Selection=="No"
fprintf("Thank you and have a nice day")
return;
end
end
end
fprintf("**********Assumed clockwise from the left point**********")
fprintf("\n\n")
W=input("Enter force value(kN/m):");
L=input("Enter length value(m) :");
RB=(W*L)/2;
RB=round(RB,2);
RA=(W*L)-RB;
RA=round(RA,2);
fprintf("\n\n");
fprintf("Your RA is %.2fkN and RB is %.2fkN",RA,RB);
fprintf("\n\n");
Selection=input("Would you like to continue?\n(please type Yes or No): ",'s');
if Selection=="Yes"
main();
else
if Selection=="No"
fprintf("Thank you and have a nice day");
return;
else
fprintf("Invalid option");
Selection=input("Would you like to continue?\n(please type Yes or No): ",'s');
fprintf("\n\n");
end
end
if Selection=="Yes"
main()
else
if Selection=="No"
fprintf("Thank you and have a nice day");
return;
else
if Beam=="Statistical Unstable"
Selection=input("Would you like to continue?\n(please type Yes or No): ");
end
end
if Selection=="Yes"
main();
else
if Selection=="No"
fprintf("Thank you and have a nice day");
return;
end
end
end
end
end
end
while Structure=='2'
m= input("Enter number of member : ");
j= input("Enter number of joint : ");
r= input("Enter number of reaction: ");
Y= 2*j - r;
if m < Y
Truss = 'Statistical Unstable';
elseif m == Y
Truss = 'Determinate' ;
elseif m > Y
Truss = 'Indeterminate';
end
fprintf ("\n\n");
fprintf("\n\n");
if Truss == "Indeterminate"
m= input("Enter number of member : ");
j= input("Enter number of joint : ");
r= input("Enter number of reaction: ");
end
Degree=m-(2*j - r);
Degree=round(Degree,1);
fprintf("\n\n");
fprintf("Your degree of determinacy is %.1f",Degree);
fprintf("\n\n");
Selection=input("Would you like to continue?\n(please type Yes or No): ",'s');
if Selection=="Yes"
main();
else
if Selection=="No"
fprintf("Thank you and have a nice day");
return;
else
if Truss=="Statistical Unstable" || Truss=="Determinate"
Selection=input("Would you like to continue?\n(please type Yes or No): ",'s');
end
if Selection=="Yes"
main()
else
if Selection=="No"
fprintf("Thank you and have a nice day");
return;
else
fprintf("Invalid option");
Selection=input("Would you like to continue?\n(please type Yes or No): ",'s');
fprintf("\n\n");
end
if Selection=="Yes"
main();
else
if Selection=="No"
fprintf("Thank you and have a nice day");
return;
end
end
end
end
end
end
end
##### 2 Kommentare1 älteren Kommentar anzeigen1 älteren Kommentar ausblenden
Rik am 5 Jun. 2021

Melden Sie sich an, um zu kommentieren.

### Kategorien

Find more on Matrox Hardware 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!