Conversion Wolfram Mathematica to Matlab (Do loop)

Hello!. I'd like to ask for your help please. This is just a question from an extremely simple Mathematica code, and I just want to know how I could convert it to the Matlab language:
Clear[sum, n]
sum = 0;
Do[sum = sum + n, {n, 1, 100}]
Print[sum]
Thank you very much!

2 件のコメント

John D'Errico
John D'Errico 2021 年 8 月 23 日
It seems like you are asking pretty basic stuff. And that says you need to read the manual. Try the MATLAB onramp tutorials.
Juan Angel
Juan Angel 2021 年 8 月 24 日
Thank you!

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

回答 (1 件)

James Tursa
James Tursa 2021 年 8 月 23 日

0 投票

result = sum(1:100);

カテゴリ

ヘルプ センター および File ExchangeLoops and Conditional Statements についてさらに検索

質問済み:

2021 年 8 月 23 日

コメント済み:

2021 年 8 月 24 日

Community Treasure Hunt

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

Start Hunting!

Translated by