How to plot cell arrays in a for loop?
2 ビュー (過去 30 日間)
古いコメントを表示
I want to plot different graphs after load data from .wav or .avi files. The problem is because information is organized in cells that contains other cells. I tried to make different types of code but it didn't work, the last part is the plot code. So I hope you can help me This is my code:
files= dir('*.wav')
numfiles=length(files)
mydata= cell(numfiles,1);
info=cell(numfiles,1)
isFileSupported = true(numfiles, 1) ;
for j=1:numfiles
try
info{j}=mmfileinfo(files(j).name)
audio = info{j}.Audio
video = info{j}.Video;
catch ME
isFileSupported(j) = false;
continue;
end
end
supportedFiles = files(isFileSupported);
for k=1:numel(supportedFiles)
mydata{k}=importdata(supportedFiles(k).name);
end
for j=1:numfiles
H=mydata{k};
x={:}
y={:}
plot(x,y)
end
0 件のコメント
回答 (1 件)
dpb
2015 年 8 月 14 日
for k=1:numel(supportedFiles)
dat=importdata(supportedFiles(k).name);
figure % presume want a new figure for each file...
plot(dat(:,1), dat(:,2:end)) % presume 1st column is x, any others are to be plotted
end
2 件のコメント
dpb
2015 年 8 月 17 日
Use debugger and let us know what the result of numel(supportedFiles) and
which dat
after the importdata call. Needs must know what's you got; we have no data from which to work that lets us know what form any of the results are returned (or if any are, even).
参考
カテゴリ
Help Center および File Exchange で Audio and Video Data についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!