MM = 24;
days = 1;
while MM > 0
MM = MM - randi(5);
MM = MM - 7;
days = days + 1;
end
days
plot(days,MM)
%I'm trying to plot the values of MM on the y axis for days 1-4 on the x axis but nothing shows up on the plot.

댓글 수: 1

Christina Allen
Christina Allen 2021년 4월 19일
how can i sequence the data? i set days up in the while loop to be iterated so I figured that would end up making it a sequence.

댓글을 달려면 로그인하십시오.

답변 (1개)

Jonas
Jonas 2021년 4월 19일

0 개 추천

your plot contains only one data point because days is 1 x 1 and MM is 1 x1. If you are interested the sequence of data you also have to store the sequence of data

댓글 수: 2

Christina Allen
Christina Allen 2021년 4월 19일
how can i sequence the data? i set days up in the while loop to be iterated so I figured that would end up making it a sequence.
Jonas
Jonas 2021년 4월 19일
just add something during the while like dailyValues(days)=MM . i'm not sure which value you want to save per day

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

질문:

2021년 4월 19일

댓글:

2021년 4월 19일

Community Treasure Hunt

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

Start Hunting!

Translated by