help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Loading data from file and omitting some extensions


From: Ben Abbott
Subject: Re: Loading data from file and omitting some extensions
Date: Wed, 22 Jan 2014 19:50:50 -0500

On Jan 22, 2014, at 6:07 AM, st.michal88 <address@hidden> wrote:

> Thanks Andy! This is really good but in fact I realised that it doesn't solve
> my problem. My files are indeed classified as "plain text document" but it
> doesn't have implicit .txt ending. Is there a way to do something similar
> but not by filtering all the .txt but excluding e.g. .png? 
> 
> Regards,
> Michal

You could also remove the unwanted files before the loop.  I haven't tested the 
code below, but the idea is straight forward.

files = readdir (pwd ());
[~,  ~,  suffix] = cellfun (@fileparts, files, "uniformoutput", false);
files = files(ismember (suffix, {".png", ".gif"});

for n = 1:numel(files)
# process the files here
end

Ben

reply via email to

[Prev in Thread] Current Thread [Next in Thread]