Conversion from Mathematica to Matlab

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
1 reply · 2K views
Juan Angel
Messages
1
Reaction score
0
Hello!.
I am new to the forum and I am also a newbie to programming. I want to convert a Mathematica code to Matlab, but I don't understand how to translate these lines. This code is Mathematica 5.0.

defvar := Module[{a}, Clear[ cN, cNf, ginix ]; Clear[ Nh, Nhf, gini ]; cN = Array[Nh, dim]; cNf = Array[Nhf, dim]; ginix = Array[gix, steps];]

where dim = 1000; steps = 1.

I thank you very much!
 
Physics news on Phys.org
Why not read a Mathematica manual, as these seem like core language features that you need to understand in order to effect a translation?

Sometimes though it's better to have your new program loosely based on the old as in you understand the algorithm used in the old one and then just write one in your new language whatever it may be.

Oftentimes, the devil is in the details where your translation gets looping off by one because it starts with 1 vs 0 or a division operator is type-based (int for ints, float for floats) vs always returns a float...