I'm trying to create a for loop that is able to display 1:k loops that can retain values for theta(i:k) while renaming the user input according to the iteration number(e.g. 'Please enter the fiber angle theta 5' as a user input for the 5th iteration)

1 view (last 30 days)
%another main goal would be to be able to rename Qbartheta(i) for each iteration number. In a nutshell, basically anywhere the code says (i) I would like to display the iteration number. Any help would be greatly appreciated!!!! Thank you in advance%
k=input('How many angles will be used?... # of angle orientations = ');
for i=1:k
disp(['Please enter the fiber angle theta(i)',num2str(i)]);
theta(i)=input('....theta(i) = ');
disp(['Please enter the weight, in grams, of fabric oriented in theta(i)', num2str(i)]);
fwtheta(i)=input('...Weight (i) = ');
Qbar11theta(i)=Q(1,1)*(cosd(theta(i)))^4+2*(Q(1,2)+2*Q(3,3))*(sind(theta(i)))^2*(cosd(theta(i)))^2+Q(2,2)*(sind(theta(i)))^4;
..................
.continues forever
.........................
Sbar66theta(i)=2*(2*S(1,1)+2*S(2,2)-4*S(1,2)-S(3,3))*[(sind(theta(i))).^2*(cosd(theta(i))).^2]+(S(3,3)*((sind(theta(i))).^4+(cosd(theta(i)))^4));
end

Accepted Answer

Walter Roberson
Walter Roberson on 26 Jun 2013
For example,
theta(i) = input(sprintf('....theta(%d) = ', i));

More Answers (0)

Categories

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