Converting entries from array to double from an entire column in a matrix for plotting
Show older comments
I have this file which I want to analyse for temeprature fluctuations:
D=readtable('tempDataTrollhFlygpl.xlsx', 'NumHeaderLines', 10) % anger 10 rubrikrader slik at jeg kan ekstrahere kolonne entries mer effektivt
val = str2double(D{:,3});
val2 = str2double(D{:,4});
plot(D,'Var3','Var4')
So I triwed to convert all entries in table 3 and 4 to doubles, so that they can be plotted by calling their sets as "val" and "val2", but those names were not recognized by plot, so I used what MATLAB suggested, namely Var3 and Var4, for the 3d and 4th respective columns.
How can I can plot this, and also, how can I find the most recurring number in the column 4, that is the most recurring temperature over that period defined in column 3?
I was also trying to view the distribution of the temperatures as a histogram, so I did the following:
histogram(val2,val)
But also this didn't work.
Any ideas appreaciated!
Thanks
Accepted Answer
More Answers (1)
hello
here you are
D=readtable('tempDataTrollhFlygpl.xlsx', 'NumHeaderLines', 10) % anger 10 rubrikrader slik at jeg kan ekstrahere kolonne entries mer effektivt
time = D{:,3};
temp = str2double(D{:,4});
figure(1)
plot(time,temp)
figure(2)
histogram(temp)
3 Comments
Sergio
on 15 Feb 2024
Star Strider
on 15 Feb 2024
The ‘y’ values are not degrees. They are the number of times a particular degree value (x-axis) appears in the ‘Var4’ data.
Sergio
on 15 Feb 2024
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

