From: nolwenn Guillemot on
Hi,
I have to use a while loop and inside a test with an if. I know it's bad but I don't have the choice. If I don't write a pause or a drawnow between the two loop, MatLab crash. In fact, at the end of my loop, I refresh a figure. It takes too much time and I want it faster. I had a "drawnow" after my "set" but this does the same thing that a pause and apparently I need a pause between my two loops.

There is my code :

while(ishandle(plotHandle))
pause(0.01);

if DSP_transfert.start==1,

treatment;

%Display---------------------------------------------------

if DSP_transfert.freeze==0
set(plotHandle,'YDATA',Buffer);
set(plotHandle1,'YDATA',Buffer2);
end
end
end


The ideal would be to display the figure in parrallel but I think I don't have the Matlab parallel thing beacause matlabpool does not exist. If some body could help me ... thank you very much
From: Sean on
"nolwenn Guillemot" <nolwenn.guillemot(a)hotmail.fr> wrote in message <i245fl$i9e$1(a)fred.mathworks.com>...
> Hi,
> I have to use a while loop and inside a test with an if. I know it's bad but I don't have the choice. If I don't write a pause or a drawnow between the two loop, MatLab crash. In fact, at the end of my loop, I refresh a figure. It takes too much time and I want it faster. I had a "drawnow" after my "set" but this does the same thing that a pause and apparently I need a pause between my two loops.
>
> There is my code :
>
> while(ishandle(plotHandle))
> pause(0.01);
>
> if DSP_transfert.start==1,
>
> treatment;
>
> %Display---------------------------------------------------
>
> if DSP_transfert.freeze==0
> set(plotHandle,'YDATA',Buffer);
> set(plotHandle1,'YDATA',Buffer2);
> end
> end
> end
>

Why do you need a pause; to slow it down? A drawnow is necessary for the figure to update; yes. What are you doing to have to refresh the figure every few seconds? I'll bet there's a better way around that.


> The ideal would be to display the figure in parrallel but I think I don't have the Matlab parallel thing beacause matlabpool does not exist. If some body could help me ... thank you very much

This is very much doable without the parallel computing toolbox. I don't think you're completely understanding how the figure works.
From: nolwenn Guillemot on
"Sean " <sean.dewolski(a)nospamplease.umit.maine.edu> wrote in message <i247qk$j4i$1(a)fred.mathworks.com>...
> "nolwenn Guillemot" <nolwenn.guillemot(a)hotmail.fr> wrote in message <i245fl$i9e$1(a)fred.mathworks.com>...
> > Hi,
> > I have to use a while loop and inside a test with an if. I know it's bad but I don't have the choice. If I don't write a pause or a drawnow between the two loop, MatLab crash. In fact, at the end of my loop, I refresh a figure. It takes too much time and I want it faster. I had a "drawnow" after my "set" but this does the same thing that a pause and apparently I need a pause between my two loops.
> >
> > There is my code :
> >
> > while(ishandle(plotHandle))
> > pause(0.01);
> >
> > if DSP_transfert.start==1,
> >
> > treatment;
> >
> > %Display---------------------------------------------------
> >
> > if DSP_transfert.freeze==0
> > set(plotHandle,'YDATA',Buffer);
> > set(plotHandle1,'YDATA',Buffer2);
> > end
> > end
> > end
> >
>
> Why do you need a pause; to slow it down? A drawnow is necessary for the figure to update; yes. What are you doing to have to refresh the figure every few seconds? I'll bet there's a better way around that.
>
>
> > The ideal would be to display the figure in parrallel but I think I don't have the Matlab parallel thing beacause matlabpool does not exist. If some body could help me ... thank you very much
>
> This is very much doable without the parallel computing toolbox. I don't think you're completely understanding how the figure works.


I agree with you I am a little lost.
If I do not write the "pause" after the while, MatLab could not do anything, it crash, and I have to force it close. When I write "pause" the figure is refresh during the pause so I delete the drawnow to not have a supplementary pause.

To answer you, I use this program to voice data acqusition. The voice is modified on Matlab and write on headphones. The executive time have to be very short because the subject does not have to hear the latency time. We want to see the spectrum of the voice in real time.

Thanks for your answer.
From: Sean on

> I agree with you I am a little lost.
> If I do not write the "pause" after the while, MatLab could not do anything, it crash, and I have to force it close. When I write "pause" the figure is refresh during the pause so I delete the drawnow to not have a supplementary pause.
>
> To answer you, I use this program to voice data acqusition. The voice is modified on Matlab and write on headphones. The executive time have to be very short because the subject does not have to hear the latency time. We want to see the spectrum of the voice in real time.
>
> Thanks for your answer.

Do you have the data acquisition toolbox?
Also take a peek at timers
>>doc timer
From: nolwenn Guillemot on
"Sean " <sean.dewolski(a)nospamplease.umit.maine.edu> wrote in message <i24fst$hb3$1(a)fred.mathworks.com>...
>
> > I agree with you I am a little lost.
> > If I do not write the "pause" after the while, MatLab could not do anything, it crash, and I have to force it close. When I write "pause" the figure is refresh during the pause so I delete the drawnow to not have a supplementary pause.
> >
> > To answer you, I use this program to voice data acqusition. The voice is modified on Matlab and write on headphones. The executive time have to be very short because the subject does not have to hear the latency time. We want to see the spectrum of the voice in real time.
> >
> > Thanks for your answer.
>
> Do you have the data acquisition toolbox?
> Also take a peek at timers
> >>doc timer

I'll try the data acquisition toolbox.
I realize MatLab crashes when the if's expression is wrong in infinite while loop. I don't really understand why ...

Thanks for all your answers.