help-octave
[Top][All Lists]
Advanced

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

Re: Problem : loading external list


From: Juan Pablo Carbajal
Subject: Re: Problem : loading external list
Date: Sat, 8 Dec 2012 14:54:57 +0100

On Fri, Dec 7, 2012 at 6:46 PM, Emilie04 <address@hidden> wrote:
> Hello everybody,
>
> My script functions perfectly on MATLAB, but in my lab, I have to test on
> Octave. So I transform my script for that it's conform to Octave (the
> difference is only, I think, the command to load external lists).
>
> The script runs at the beginning, but when it arrives at the moment where it
> has to load the file in .txt, nothing happens (in bold in the script
> beside).
>
> Here, this is a part of my script. Have you an idea of what is
> dysfunctioning? Thank you very much
>
> w=Screen('OpenWindow', 0);
> cycleRefresh=Screen('GetFlipInterval', w);
>
> HideCursor
>
> [width, height]=Screen('WindowSize', w);
>
> %% ETAPE 2: INSTRUCTIONS
>
> instruction=imread('Instruction1.jpg');
> Screen(w, 'FillRect', [255, 255, 255])
> Screen('Putimage', w, instruction)
> Screen(w, 'Flip')
> [secs, keyCode, deltaSecs]=KbWait
> WaitSecs(0.3)
>
> %% ETAPE 4 : IMPORTATION DES FICHIERS
>
> *items=[];
>         fid = fopen('horlogealea.txt');
>                 while ~feof(fid)
>                         temp=sscanf(fgetl(fid), '%s');
>                         items=[items;temp];
>                         temp=[];
>                 end
>         fclose(fid);
> items = cellstr(items);*
>
> nItems=length(items); % spécifie la longueur de la liste
> tex=zeros(1,nItems);% Textures
>
>
> Order=randi(length(items)):length(items) % Premier stimulus aléatoire, puis
> suite de la liste
>
> *stimuli=[];
>         fid = fopen('horloge.txt');
>                 while ~feof(fid)
>                         temp=sscanf(fgetl(fid), '%s');
>                         stimuli=[stimuli;temp];
>                         temp=[];
>                 end
>         fclose(fid);
> stimuli = cellstr(stimuli);*
>
>     nStim=length(stimuli);
>     texstim=zeros(1,nStim);
>
>     vbl=Screen(w, 'Flip');
>
>     %% ETAPE 5 : HORLOGE AL»ATOIRE
>
>             for g=Order
>                 img=imread(items{g});
>                 tex(g)=Screen('MakeTexture', w, img); %Faire les textures
>                 Screen('drawtexture', w, tex(g))
>                 vbl=Screen(w, 'Flip', vbl+(2.5*cycleRefresh));
>                 KbCheck;
>             end
>
> ...
>
>
>
> --
> View this message in context: 
> http://octave.1599824.n4.nabble.com/Problem-loading-external-list-tp4647632.html
> Sent from the Octave - General mailing list archive at Nabble.com.
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://mailman.cae.wisc.edu/listinfo/help-octave

Hi,
The part where you read the txt file looks alright, maybe redundant.
fgelt already gives you a string so instead of calling sscanf on top
of fgetl seems to be useless. If you want to read formatted input, you
could use fscanf.

There are many functions in your script that will not work in Octave.
Are you sure the failure is not in one of those?


Cheers


reply via email to

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