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 views (last 30 days)
Show older comments
Answers (1)
Umar
on 3 Jul 2024
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.
0 Comments
See Also
Categories
Find more on Data Import and Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!