Conversion Wolfram Mathematica to Matlab (Do loop)

1 vue (au cours des 30 derniers jours)
Juan Angel
Juan Angel le 23 Août 2021
Commenté : Juan Angel le 24 Août 2021
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 commentaires
John D'Errico
John D'Errico le 23 Août 2021
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 le 24 Août 2021
Thank you!

Connectez-vous pour commenter.

Réponses (1)

James Tursa
James Tursa le 23 Août 2021
result = sum(1:100);

Catégories

En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by