Clear Filters
Clear Filters

App designer for composite bars for n inputs

1 view (last 30 days)
Hey there, I am trying to build an app for composite bars, the inputs depend on the user's requirement. How do i get multiple inputs window ? (for ex: if n= 10, the edit field boxes must be the n for further inputs (i.e 10). Here's my code for the same on matlab
disp('1 - Circular cross-section');
disp('2 - Rectangular cross-section');
choice = input('Enter the type of cross-section: ');
n = input('Enter the number of cross-sections: ');
F = input('Enter the load in N: ');
if choice==1;
A=zeros(n,1)
Delta=A;
for i=1:n
fprintf('Enter the Youngs modulus of Bar %i : \n',i );
E = input('y =');
fprintf('Enter the length of Bar %i: \n',i );
L = input('b =');
fprintf('Enter the diameter of Bar %i:\n',i );
D = input('s =');
A(i,1) = (pi*(D^2)/4 );
Delta(i,1) = ((F*L)/(A(i,1)*E ));
end
for j=1:n
fprintf(' Total extension of the bar %i: %f. \n' ,j,Delta(j,1 ) );
end
elseif choice==2;
A=zeros(n,1)
Delta=A;
for i=1:n
fprintf('Enter the Youngs modulus of Bar %i : \n',i );
E = input('y =');
fprintf('Enter the length of Bar %i: \n',i );
L = input('b =');
fprintf('Enter the breadth of Bar %i:\n',i );
D = input('s =');
A(i,1) = L*D;
Delta(i,1) = ((F*L)/(A(i,1)*E ));
end
for j=1:n
fprintf(' Total extension of the bar %i: %f. \n' ,j,Delta(j,1 ) );
end
end

Answers (0)

Community Treasure Hunt

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

Start Hunting!