How to plot a cell array

조회 수: 5 (최근 30일)
Katrina Anderson
Katrina Anderson 2018년 11월 29일
편집: madhan ravi 2018년 11월 29일
I have a cell: Behaviourcoded {} 285768x1 with numerical values.
The data consists of 1,2,3 - which represent a behaviour variable.
Each point represents 1/500sec.
I am wanting to plot the data but im not sure how to plot a cell array.
I have tried this:
figure;
hold on;
cellfun(@plot,Behaviourcoded);
but this does not work. I just get a blank graph.
Thanks Katrina

채택된 답변

madhan ravi
madhan ravi 2018년 11월 29일
plot([Behaviourcoded{:}])
  댓글 수: 2
Katrina Anderson
Katrina Anderson 2018년 11월 29일
Hi,
thankyou. It does work, but the graph is quite hard to follow. I have attached it.. Not sure how i can best visualise what I have. Whether I could correlate to time.
Thankyou!
madhan ravi
madhan ravi 2018년 11월 29일
편집: madhan ravi 2018년 11월 29일
Probably it depends upon the data as well but in the answer above each data is plotted against corresponding index , maybe attach your data as a .mat file to experiment.
Try
cell2mat(Behaviourcoded)
vertcat(Behaviourcoded)
these are also a probability to concatanete cell arrays.

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by