vectors are not same for ploting

ind=strcmpi(names,'United States');
cases=covid_cases(ind,:)
deaths=covid_deaths(ind,:)
daily_cases=dailycases(ind,:)
fatalityr=deaths./cases;
fatality_per = fatalityr*100;
moving_avg=movmean(daily_cases,10)
scatter(moving_avg,fatality_per(:,end-1))
moving_avg 57*429 double
fatality_per 57*430 double
vector are not same what should be the modification in order to make scatter plot

 Respuesta aceptada

Cris LaPierre
Cris LaPierre el 29 de Mayo de 2021

0 votos

Make moving_avg a 57x429 array, or make fatality_per a 57x429 array.
It appears you have more columns of data in dailycases than you do in covid_cases and covid_deaths

5 comentarios

Muhammad
Muhammad el 30 de Mayo de 2021
yes that the problem ,how i can makes the columns of both moving_avg and fatality_per same
tell me some modification in codes as i did
scatter(moving_avg,fatality_per(:,end-1))
but it is not working
Walter Roberson
Walter Roberson el 30 de Mayo de 2021
scatter does not accept 2d array
Sure it does (at least in 2021a).
x=rand(2,4);
y=rand(2,4)
y = 2×4
0.0880 0.6121 0.4893 0.5943 0.8218 0.1274 0.6707 0.1948
scatter(x,y)
Walter Roberson
Walter Roberson el 30 de Mayo de 2021
Editada: Walter Roberson el 30 de Mayo de 2021
That is new as of R2021a; in R2020b it still did not accept arrays.
The user posted the error message in https://www.mathworks.com/matlabcentral/answers/843480-error-while-scatter-ploting?s_tid=srchtitle and it specifically says "vectors" in their release.
Image Analyst
Image Analyst el 30 de Mayo de 2021
@Muhammad SULAMAN, what do the rows represent in your array? What do the columns represent? Does it make sense to lump them all together into one massive scatterplot? Or would it be more understandable to scatter just two corresponding rows or columns against each other?

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Preguntada:

el 29 de Mayo de 2021

Comentada:

el 30 de Mayo de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by