Having issues producing bar chart

조회 수: 1 (최근 30일)
Siddharth Satishchandran
Siddharth Satishchandran 2021년 6월 20일
댓글: the cyclist 2021년 6월 20일
I am producing a bar chart from extracted data of mean call rates of three individuals. The code I am using is
bar(categorical({'ID 1','ID 2','ID 3'}),[mn1 mn2 mn3])
xlabel(Animal ID''s')
ylabel('Mean Call Rate')
title('Mean Call Rate for Animal IDs')
An error was produced but I thought I wrote the code correctly:
bar(categorical({'ID 1','ID 2','ID 3'}),[mn1 mn2 mn3])xlabel(Animal ID''s')ylabel('Mean Call Rate')title('Mean Call Rate for Animal IDs')
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parantheses
Could you please let me know which area of the code is incorrect so i can change it and produce the bar chart?

채택된 답변

the cyclist
the cyclist 2021년 6월 20일
편집: the cyclist 2021년 6월 20일
I assume you got error from this line:
xlabel(Animal ID''s')
You have mismatched single quotes, i.e. "unbalanced delimiters", as the error says. It should be
xlabel('Animal ID''s')

추가 답변 (1개)

Siddharth Satishchandran
Siddharth Satishchandran 2021년 6월 20일
How Do I export code and figures like barcharts from matlap if I need to send them out through email?
  댓글 수: 1
the cyclist
the cyclist 2021년 6월 20일
You can use the print command to save a figure to a file.
In the future, I would suggest openining a new question, when it is completely unrelated to the current one. Notice your new question looks like an "Answer" to your original one, which will be confusing to other users.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Bar Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by