How to store the output?
4 ビュー (過去 30 日間)
古いコメントを表示
How to store the output of the following for loop ?
import java.math.*;
a = BigInteger('12345678');
c = Biginteger('67436255757');
n = BigInteger('10');
for i=1:double(n)
a = my_function(a,c );
end
where
function [a] = my_function(b,c )
import java.math.*;
a = b.add(c) ;
end
Thanking in anticipation.
0 件のコメント
回答 (2 件)
Arif Hoq
2022 年 3 月 5 日
import java.math.*;
a = BigInteger('12345678');
c = BigInteger('67436255757');
n = BigInteger('10');
for i=1:double(n)
y = my_function(a,c );
end
output=sprintf('%10.0f',y)
Image Analyst
2022 年 3 月 6 日
for k = 1 : round(n)
a(k) = my_function(a, c); % Save the output for every iteration of the loop.
end
2 件のコメント
Image Analyst
2022 年 3 月 12 日
編集済み: Image Analyst
2022 年 3 月 12 日
What data class is n?
whos n
If n is already an integer, you don't need to round it
for k = 1 : n
a(k) = my_function(a, c); % Save the output for every iteration of the loop.
end
参考
カテゴリ
Help Center および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!