Issue Plotting 2 different Values
3 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
Peter Perkins
2022 年 12 月 9 日
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 件のコメント
Shivansh
2022 年 12 月 13 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!