Loop, function or memory problem: Loop variable in a function is limited automatically.
古いコメントを表示
Hi to all,
I am processing 3D images. In one of the functions i wrote, "for" loop variable is limited to 262144 while it should not be. My loop is just like :
For i = 1 : 26214400 %( 1 : 512*512*100 ) .... end
In case it is a memory problem, i deleted some data to get more space on the memory my script uses but it did not work. The limit value does not change. I tried it on both uint8 and double data.
By the way i use Windows 7, i have 4 GB Memory. I strongly need help about this.
Thanks to all.
Ibrahim
7 件のコメント
Robert Cumming
2011 年 4 月 12 日
what is the error message you get?
David Young
2011 年 4 月 12 日
Could you cut and paste the actual code you use? Clearly, the example in your question is not the code, because it has "For" instead of "for".
Gautam Vallabha
2011 年 4 月 12 日
check the size of your image (is it really 512x512x100 or is it just 512x512)?
Ibrahim harmankaya
2011 年 4 月 12 日
Matt Fig
2011 年 4 月 12 日
Hmm, something weird is going on. Can you verify that this works at the command line:
for ii = 1:512*512*100,jj = ii/2;end,jj*2==512*512*100
Ibrahim harmankaya
2011 年 4 月 12 日
Matt Fig
2011 年 4 月 12 日
So it works at the command line, it should work in the function. There is more to the story that we cannot see because we don't have the code....
採用された回答
その他の回答 (2 件)
Jan
2011 年 4 月 12 日
1 投票
What exactly does "stops and quit" mean? Did you use the debugger to find out, which line causes the break? Just insert a "if i == 262144, disp('catch'); end" and set a break point on the disp line. Then step through the code line by line. It is impossible for us to guess, which command in which line is responsible.
Matt Fig
2011 年 4 月 12 日
Hmm, something weird is going on. Can you verify that this works at the command line:
for ii = 1:512*512*100,jj = ii/2;end,jj*2==512*512*100
Also, in your loop is there a BREAK or RETURN statement anywhere?
カテゴリ
ヘルプ センター および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!