I have to plot multiple graphs on the same plot reading .sgl files ; the code i have is as follows; I am not sure how to make it read every file in turn; thanks

8 views (last 30 days)
for i=1:size(filelist,1) sgl=read_hsgl_riff('P*.sgl'); sgl.format; sgl.data; x=sgl.data(:,1); y=sgl.data(:,2); plot(x,y); hold on; end

Answers (1)

Thorsten
Thorsten on 20 Jul 2016
Edited: Thorsten on 20 Jul 2016
If filelist is a cell array of your filenames, use
for i = 1:numel(filelist9
sgl=read_hsgl_riff(filelist{i});
% more code here
end
  1 Comment
RB
RB on 20 Jul 2016
My files are in a folder among other non sgl files that I do not want to read;so I wrote this out of the loop filelist = dir( [ DIRECTORY, '/P*.sgl' ] ); i get this error "Cell contents reference from a non-cell array object "

Sign in to comment.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!