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

37 ビュー (過去 30 日間)
NN 2020 年 8 月 20 日
コメント済み: Rik 2021 年 6 月 5 日
can someone help to write matlab code the attached flowchart ?
##### 1 件のコメント表示非表示 なし
Rik 2020 年 8 月 20 日

サインインしてコメントする。

### 回答 (2 件)

Jalaj Gambhir 2020 年 8 月 24 日
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 件のコメント表示非表示 -1 件の古いコメント

サインインしてコメントする。

Naven Raj 2021 年 6 月 5 日
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 件のコメント表示非表示 1 件の古いコメント
Rik 2021 年 6 月 5 日

サインインしてコメントする。

### カテゴリ

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!

Translated by