Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Mathematica to MATLAB translation

  1. May 29, 2012 #1
    Hi, I have some Mathematica code I wanna translate in Matlab, does anyone know how to translate the Table [expr,{i,a,b}]to Matlab? I made one with a loop, but loops are very slow and I am going to analyze large datasets with the functions.
  2. jcsd
  3. Jun 2, 2012 #2
    I'm neither a Matlab nor Mathematica user, however, could you rewrite expr as a function f of i, create a vector running from a to b (something like i = a:b, perhaps?) and then apply f to i using arrayfun (maybe you could use expr as an anonymous function?

  4. Jun 11, 2012 #3
    Even simpler, I just created a vector say k=1:40 and then wrote my function say 5*k+12.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook