MATLAB Answers


Wildcard problem while transferring the code to Octave

Asked by Yaren Koca on 13 Jul 2018 at 20:54
Latest activity Commented on by Rik Wisselink
on 14 Jul 2018 at 10:52
folder = 'C:\Users\lenovo\Desktop\CANADA\LAB\IFL-Experiment\Target';
files = dir(folder);
images = cell(nBlocks, nTargetsPerBlock);
for i = 1:nBlocks
    tempPath = strcat(folder, '\T', num2str(i));
    fileFull = fullfile(tempPath, {'*.jpg'; '*.png'});
    files = dir(fileFull{1});
    for j =  1:nTargetsPerBlock
        currentfilename = files(j).name;
        fullFileName = fullfile(tempPath, currentfilename);
        currentimage = imread(fullFileName);
        images{i, j} = currentimage;

When I transfer this code to octave, I get the error "A(I): index out of bounds; value 1 out of bound 0". (I double checked to make sure that the folders have enough images.) Further, when I was debugging I wanted to check "dir(fileFull{1})", and I got the error "warning: dir: nonexistent directory 'C:\Users\lenovo\Desktop\CANADA\LAB\IFL-Experiment\Target\T1\*.jpg'. It seems the problem is with the wildcard. Is there anything that I can use to read all my files in the specified directory in Octave? I also would like to note that the code works perfectly fine in Matlab. Thank you.

  1 Comment

For my this syntax is working fine (W10,x64,v4.2.0). If you really believe that this is not working, then you should go to the Octave bug-tracker.

Because this is a forum for Matlab, you should be hesitant to post questions about Octave, because they are essentially competing products. If you post questions about Octave, always use the octave tag (as you correctly did), and mention the OS and release.

Sign in to comment.

0 Answers