Creating Graphs from Data in a .csv Files
35 次查看(过去 30 天)
显示 更早的评论
The file Windhoek_temp_01_2022.csv contains temperature information for the month of January 2022. For each day of the month, the average temperature [C], minimum temperature [C], maximum temperature [C] are tabulated.
After loading the data, create a graph visualizing the temperatures (all in the same graph). Choose visually pleasing intervals to be shown for the abscissa and ordinate. Follow all guidelines regarding the creation of "proper" graphs. Don't forget to provide a meaningful title for your graph.
Note: You will receive at most 5 points if you manually copy and paste the data into the Jupyter Notebook.
This are the codes i have so far but they don't bring up any graph
my_csv=readtable('Windhoek_temp_01_2022.csv'); %Reading the data
disp(my_csv); % Displaying the data just to confirm
% Creating a path for the headers
Temperature = my_csv(:,1);
Average_Temperature =my_csv(:,2);
Minimum_Temperature =my_csv(:,3);
Maximum_Temperature =my_csv(:,4);
plot(Temperature,Average_Temperature);
plot(Temperature,Minimum_Temperature);
plot(Temperature,Maximum_Temperature);
shg()
0 个评论
回答(1 个)
Voss
2022-5-31
Subscripting a table with ( ) gives you another table. To get the data out of a table, subscript with { }
my_csv=readtable('Windhoek_temp_01_2022.csv'); %Reading the data
disp(my_csv); % Displaying the data just to confirm
% Creating a path for the headers
Temperature = my_csv{:,1};
Average_Temperature =my_csv{:,2};
Minimum_Temperature =my_csv{:,3};
Maximum_Temperature =my_csv{:,4};
plot(Temperature,Average_Temperature);
plot(Temperature,Minimum_Temperature);
plot(Temperature,Maximum_Temperature);
shg()
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


