I'm trying to figure out a way to ask the user for data on a specific load point using input and sprintf. But every time the next data is obtained from the user, the previous data disappears?

1 view (last 30 days)
The section for this reads:
for i=1:point_loads
input(sprintf('What is the magnitude, direction, and location ([mag,dir,loc]) of load %0.0i',i));
end
I need a way to later obtain the data for the locations at each point.
I've tried setting the line starting with input equal to a variable, then I tried a(i), and then I tried [a(i),b(i),c(i)]. But every time I receive an error.

Accepted Answer

Walter Roberson
Walter Roberson on 18 Apr 2014
for i=1:point_loads
a(i,:) = input(sprintf('What is the magnitude, direction, and location ([mag,dir,loc]) of load %0.0i',i));
end
For this to work the user will need to type in the [] around the values.
You should consider using inputdlg()

More Answers (0)

Community Treasure Hunt

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

Start Hunting!