From: us on
"Fabrizio Assabese"
> I've created a gui and insert following code:
>
> tastocorrente=gcf;
> valore= double(get(tastocorrente, 'CurrentKey'));
> if valore~=113
> % straight direction
> set(handles.edit1, 'String', 'Direzione Sbagliata');
> %this show that the direction is wrong if wrong key in pressed.
> end;
>
> Now I need to save current key in a text file to retrieve the information at the end of application, in particular, for each frame I need to associate webcam frame, image of path and key pressed. I think i've to create an array of structures to save together this informations.

a hint:
- at the outset of your code,
--- initialized a counter, eg, IC, to zero...
--- preallocate a vector, eg, VEC, with the #frames (or expected responses)...
- then, save the values (VALOREs) at the position IC in your VEC, eg,

ic=ic+1;
vec(ic)=valore;

- save your VEC when the experiment is done...

us
From: Fabrizio Assabese on
"us " <us(a)neurol.unizh.ch> wrote in message <i1k5us$mee$1(a)fred.mathworks.com>...
> "Fabrizio Assabese"
> > I've created a gui and insert following code:
> >
> > tastocorrente=gcf;
> > valore= double(get(tastocorrente, 'CurrentKey'));
> > if valore~=113
> > % straight direction
> > set(handles.edit1, 'String', 'Direzione Sbagliata');
> > %this show that the direction is wrong if wrong key in pressed.
> > end;
> >
> > Now I need to save current key in a text file to retrieve the information at the end of application, in particular, for each frame I need to associate webcam frame, image of path and key pressed. I think i've to create an array of structures to save together this informations.
>
> a hint:
> - at the outset of your code,
> --- initialized a counter, eg, IC, to zero...
> --- preallocate a vector, eg, VEC, with the #frames (or expected responses)...
> - then, save the values (VALOREs) at the position IC in your VEC, eg,
>
> ic=ic+1;
> vec(ic)=valore;
>
> - save your VEC when the experiment is done...
>
> us

My acquisition is potentially infinite. Is it possibile to preallocate an infinite vector?
I need to save together images and respective keyboard response. I'm trying to save images (that should be saved as a matrix my ML) and an additional value containing keyboard response. Could it be right way?
From: Walter Roberson on
Fabrizio Assabese wrote:

> My acquisition is potentially infinite. Is it possibile to preallocate
> an infinite vector?


Unfortunately not. Because each vector location takes multiple bytes,
and there is a header for each variable, Matlab cannot actually fit the
storage for an infinite vector. The largest vector that can be used in
practice is sqrt(infinity)