Issue Plotting 2 different Values
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have two excel files, the script extracts the data from the 2 files. I need to plot the water level for each specific year on y axis and ice conentration average on x axis. The script works for specific years but not for some because of not same vector size. The script finds the values range from 1st of october to the 1st of october of the other year. Any help on how i could do that better
Thanks
0 comentarios
Respuestas (2)
Peter Perkins
el 9 de Dic. de 2022
Cedric, I can't really follow your code or your explanation, but I would think you want something like this:
ice = readtimetable("Ice concentration data.csv")
opts = detectImportOptions("15330-01-JAN-1970_slev.csv",Delimiter=',',NumHeaderLines=7);
opts = setvaropts(opts,"Obs_date",Type="datetime",InputFormat="uuuu/MM/dd");
water = readtimetable("15330-01-JAN-1970_slev.csv",opts)
Throw away water data outside the range of the ice data.
water = water(timerange(min(ice.DateTime),max(ice.DateTime)),:);
Fill in the ice data with missing values and plot.
ice = retime(ice,water.Obs_date,"fillwithmissing");
plot(ice.Conc_Ice_Avg,water.SLEV_metres_,'o')
If your goal is to overlay all the years on top of each other, thatneeds a few more steps, but your description doesn't seem to say say that.
0 comentarios
Shivansh
el 13 de Dic. de 2022
Hi ,
According to my understanding , you are not able to plot scatter plot because of the difference in size of two arrays i:e "Ice_Conc_values_for_this_specific_year" and "Pointe_Claire_Water_Level_values". This issue is arising because you have interpolated the "Ice concentration data" using "retime" function but have not interpolated the cell array "A" which contains water level. The possible workaround is to interpolate cell array "A" as well using retime function so that size of two arrays remain same.
0 comentarios
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!