MATLAB: 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 iteratio

for loopuser input

%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

Best Answer

For example,
theta(i) = input(sprintf('....theta(%d) = ', i));