problem, with an array

조회 수: 16 (최근 30일)
Imre Nagy
Imre Nagy 2011년 2월 23일

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
Imre Nagy
Imre Nagy 2011년 2월 24일
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 2011년 2월 25일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2011년 2월 25일
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
Imre Nagy
Imre Nagy 2011년 2월 25일
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.)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrix Indexing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by