How to limit a function to return results only above some threshold

13 ビュー (過去 30 日間)
George Ansari
George Ansari 2017 年 11 月 29 日
コメント済み: Walter Roberson 2017 年 11 月 29 日
Hi everyone, Assume:
a = [1 2 3]
b = [4 5 6]
c = [7 8 9]
D = myFunction(a, b, c)
The function returns n by 3 matrix, where n depends on a, b and c. I have encountered a problem when, for some a, b and c, the resulting matrix is very big, the Matlab doesn't want to continue the calculation saying:
Requested 67108864x26 (13.0GB) array exceeds maximum array size preference...
Is there a way to restrict the function to output results only above some certain level in, say, column #3. For example, like so:
D = D(D(:,3)>0.01,:)
This won't work in my case, since the restriction performed after myFunction has been executed. Is there a way to tell the program, that I want myFunction stop calculation when value of 3rd column gets lower than 0.01? Or maybe there is some other solution for this problem?
Thanks.
  1 件のコメント
Walter Roberson
Walter Roberson 2017 年 11 月 29 日
Like
if all(D(:,3)<0.01);
return
end
??

サインインしてコメントする。

回答 (0 件)

製品

Community Treasure Hunt

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

Start Hunting!

Translated by