a code that asks the user for a number of data to be measured, reads in the set of measurements
i understand on what to do but i dont know how to create a loop in where it would ask for the number of data to be measured and then ask for the value of each data
ex.
x=input('Enter amount of data needed to be entered:');
5
b=input ('Enter 1st value:')
c=input ('Enter 2nd value:')
d=input ('Enter 3rd value:')
e=input ('Enter 4th value:')
f=input ('Enter 5th value:')

 채택된 답변

Rik
Rik 2020년 3월 11일

0 개 추천

You can use the for keyword to start a loop.
x=input('Enter amount of data needed to be entered:');
for n=1:x
y(n)=input(___);%look into the sprintf function
end

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Entering Commands에 대해 자세히 알아보기

태그

질문:

2020년 3월 11일

댓글:

2020년 3월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by