How to code for Barchart and mean in matlab
조회 수: 5 (최근 30일)
이전 댓글 표시
Siddharth Satishchandran
2021년 6월 19일
댓글: Siddharth Satishchandran
2021년 6월 20일
I am using Matlab for the first time. I have used R before but Im new to Matlab. The new lab Im in wants me to use more Matlab in place of R programming for the next project. Im working on primate vocalizations. We have data that we have collected over months for a number of individuals. Im tryin to create a script that calculates mean call rate for just the first three animals in the dataset (no. of vocalizations/minute) and i'm trying to create a bar chart showing the call rate of each animal. It would be great If I could get some help so I can get started on working with the larger datasets for the lab. I have attched the the extracted dataset that I am using as a sample to make the barchart and the calculate the mean. I think for the mean calculation, I have to use the audio stop and start columns.
댓글 수: 0
채택된 답변
Sulaymon Eshkabilov
2021년 6월 19일
편집: Sulaymon Eshkabilov
2021년 6월 19일
Simply to use bar():
DD = readtable('Data extracted- Lab.xls');
DD = readtable('Data extracted- Lab.xls');
Mean_A =DD.AudioStartTime;
Mean_V =DD.VideoStart;
figure
bar(DD.AudioStartTime)
figure
bar(DD.VideoStart)
...
댓글 수: 2
추가 답변 (6개)
Siddharth Satishchandran
2021년 6월 19일
편집: Image Analyst
2021년 6월 19일
댓글 수: 2
Image Analyst
2021년 6월 19일
The file you uploaded had only 3 lines of data - not enough to get averages for all those call types and categories. Please upload an actual file with lots of data in it.
Sulaymon Eshkabilov
2021년 6월 19일
Error in your command syntax:
load('/Users/ameliachang/Downloads/LabelTable.mat') % one ) has to be removed.
Sulaymon Eshkabilov
2021년 6월 19일
load('C:\Users\siddharthsatish\Downloads\LabelTable.mat') % Fix directory: C:\ or D:\
댓글 수: 2
Sulaymon Eshkabilov
2021년 6월 19일
Ok. Well Mac has a different syntax for directory specs.
In that case, you can change the directory and then load the data file. Try this:
cd ~/ameliachang/'Downloads'
You may also try using "Finder" to find the folder, right-click on it, and then click "Get Info".
댓글 수: 3
Sulaymon Eshkabilov
2021년 6월 19일
cd ~/home/mluser/siddharthsatish/'Downloads' % Watch where apostrophe signs ' ' are placed
댓글 수: 4
Sulaymon Eshkabilov
2021년 6월 20일
Just put your *.mat file into your MATLAB directory, then you can load all your data with one simple command, e.g.:
load('LabelTable.mat')
참고 항목
카테고리
Help Center 및 File Exchange에서 Performance and Memory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
