problem, with an array

14 views (last 30 days)
Imre Nagy
Imre Nagy on 23 Feb 2011

Hy, I'm working on an image processing project, and I have a big problem. I have an array, it have to be increased, if some statements are all true. But it is very slow. The whole code is 349 line long, and it work well, but if I add a line like this:

myarray(x,y)=myarray(x,y)+1;

Than it would be very very slow... But if I change the type of the array to uint32, run the code, break the progress and change back the array into double, than work it well. But only if I make this whole procedure manually... I don't want to do this all the time I run the program. myarray is created by:

myarray=zeros(24, 32, 'double');

Is anything wrong with it??? (sorry for my bad english, I'm hungarian)

I made a few printed screen of my running code's profile This is ig I just run it (it is slow)

If I change the type of the array into uint32 (this is slow too)

 And this is if I change back thy type of the array into double again...: (and this is fast enough)

Please someone help me!

  4 Comments
Imre Nagy
Imre Nagy on 24 Feb 2011
Okay I'll try, but i have an other array like this, I use the same procedure with it, and it work well. I really don't understeand...
Jan
Jan on 25 Feb 2011
I cannot read the pictures created by your profiler because they exceed the right edge of the browser window. Anyhow, please use the debugger by your own to find out, which lines need the additional time.

Sign in to comment.

Accepted Answer

Jan
Jan on 25 Feb 2011
The timings from the profile pictures look almost equal for the two runs using the DOUBLE format, but slower for the UINT32 type. What exactly is the problem? You can use the profiler to find out, which lines consumes the most time. Then post these lines and the relevant other part of the program. Without seeing the code, there is nothing we can advice.
  1 Comment
Imre Nagy
Imre Nagy on 25 Feb 2011
Well there is a webcamera. I have to process the acquered images. The algorythm is mine. And it is very-very slow without doing the method wich I have written down. But if I did it. It runs well again. (the program runs with 20% CPU using.)

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!