I want to make a bar graph for this data from a csv file that has multiple information in 1 column (A) how do I make this graph

7 次查看(过去 30 天)

回答(1 个)

Umar
Umar 2024-7-3
Hi Victor,
To create a bar graph in MATLAB from data in a CSV file with multiple pieces of information in one column, you first need to read the CSV file and extract the data. Then, you can plot the data using the bar function. I will provide an example code to help achieve your goal.
% Read the CSV file
data = readmatrix('your_file.csv'); % Assuming the data is numeric
% Extract the data from column A
columnA_data = data(:, 1); % Assuming the data you need is in the first column
% Create a bar graph
bar(columnA_data); xlabel('X-axis Label'); ylabel('Y-axis Label'); title('Bar Graph from CSV Data');
Please make sure to adjust the code based on the structure of your CSV file and the specific data you want to plot. This code will read the CSV file, extract the data from column A, and then create a bar graph based on that data.
Also, for more information using the bar function, please refer to https://www.mathworks.com/help/matlab/ref/bar.html
Hope this will help resolve your problem.

类别

Help CenterFile Exchange 中查找有关 Data Import and Analysis 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by