how to plot the data in a cell array

조회 수: 1 (최근 30일)
Nicolas
Nicolas 2013년 7월 26일
I'm writing a program in order to calculate the time of appearance of each word in a txt document(a novel, for about 300,000 words).The result will be stored in a cell array. Besides, I need to plot the curve, the axes should be "time of appearance" and "range of time of appearance".
But I don't know how to plot this curve. I hope there's someone can offer me some help.

답변 (2개)

Nathan Crosty
Nathan Crosty 2013년 7월 26일
It sounds like you are looking for the cell2mat function. This will convert a cell array to numeric array which you can use to plot.
  댓글 수: 1
Nicolas
Nicolas 2013년 7월 29일
Thank you! I just found what you said.

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


Azzi Abdelmalek
Azzi Abdelmalek 2013년 7월 26일
s={'one','two','one','three','one','four','one','two'}
[a,b,c]=unique(s,'stable')
n_occ=accumarray(c,1)
out=[a' num2cell(n_occ)]
bar(n_occ)
set(gca,'xticklabel',a)
  댓글 수: 1
Nicolas
Nicolas 2013년 7월 29일
Thank you! I tried your way, it works.

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

카테고리

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