Interpret the matlab code -


i'm java programmer , have no background of matlab hence i'm clueless these lines of code matlab. when run code got error :

??? undefined function or variable 'nfile'.  error in ==> texture_id @ 29 fprintf(' \nneural network processing \n',nfile); 

i understand 'path' variable stores string, 'demo' boolean, other lines, don't want assume does...can please me , explain each lines?

here's code:

path = 'c:\users\dais\documents\matlab\data sets\';  demo = true;   elfile = dir('*.jpg');     [lu ri] = size(elfile); feat=zeros(lu,29); nomf=cell(lu,1);  nfi = 1:lu     nfile = elfile(nfi).name;       fprintf(' feature extraction file: %s \n',nfile);     nomf{nfi} = upper(nfile);       feat(nfi,:) = feature_ex([path nfile],demo); end  fprintf(' \nneural network processing \n',nfile); 

i guess whats happening here elfile = dir('*.jpg'); not find jpegs in local directory , hence lu empty , nfile never populated. place breakpoint there in code , check this. way set loop this:

for nfi=1:numel(elfile) 

as @rody oldenhuis said, use doc , elarn more each function (or press f1 when cursor in function name) should started..

%looks files extention .jpg in current directory elfile = dir('*.jpg');  %lu , ri hold rows, column lengths of elfile respectively [lu ri] = size(elfile);  %creates array of zeros of dimensions lu rows 29 columns feat=zeros(lu,29);  %creates empty cell array (doc cell) dimensions lu rows 1  nomf=cell(lu,1); columns nfi = 1:lu                                          %look through files      nfile = elfile(nfi).name;                           %get index nfi file     fprintf(' feature extraction file: %s \n',nfile);   %print string     nomf{nfi} = upper(nfile);                           %upper case     feat(nfi,:) = feature_ex([path nfile],demo);        %some external function end  fprintf(' \nneural network processing \n',nfile);      %print string 

Comments

Popular posts from this blog

c# - How to get the current UAC mode -

postgresql - Lazarus + Postgres: incomplete startup packet -

javascript - Ajax jqXHR.status==0 fix error -