MATLAB: I would like to store each iteration of a for loop into a row vector, in order. This particular problem does not start with a vector, but instead with separate scalar user inputs that must be placed into a vector. How to achieve this? Thanks!

arrayfor loop

Random variables seem to be placed into a row vector instead. I've been trying for hours and can't figure this out.
num=input('Enter the number of data points: ');
decimal=input('Enter the number of decimals you want to show: ');
for c=1:1:num
dp=input(sprintf('Data Point #%0.0f: ',c));
Vector=dp(1,c)
output(c)=Vector
end

Best Answer

I prefer the inputdlg function to input. so I use it here. Change it back if you like. (I do not recommend it, though!)
This code seems to do what you want
numc=inputdlg('Enter the number of data points: ');
num = str2num(numc{:});
decimalc=inputdlg('Enter the number of decimals you want to show: ');
decimal = str2num(decimalc{:});
for c=1:1:num
dpc=inputdlg(sprintf('Data Point #%0.0f: ',c));
dp = str2num(dpc{:});
Vector(c)=dp;
output(c)=Vector(c)
end