Mathematica equivalent of MATLAB

In summary, the conversation is about a person who just received their student copy of Mathematica 7 and wants to replicate some MATLAB m-files in Mathematica. They are confused about where to start writing their code and ask if it is possible to write the code in a separate file and call it from elsewhere in Mathematica. The response is that this is possible through the use of packages, and there is information available in the online help about using and building packages.
  • #1
Saladsamurai
3,020
7
Hey folks :smile:

I just got my student copy of Mathematica 7 and I am really excited to get started. I have some MATLAB m-files that I want to replicate in Mathematica to help me get the syntax.

I am a little confused as to where to start writing it though... In MATLAB, you can write a code in an m-file and then go to the command window and call it whenever necessary so long as the m-file is in the current working directory. I would like to the Mathematica equivalent now, but I am not sure where to write my code?

Is this possible? Can I write my code as its own separate file and then call it from elsewhere in Mathematica?

Sorry for the noob question, but I just want to get started! :Smile:

~Casey
 
Physics news on Phys.org
  • #2
Yes, it is called a "package". There is a decent amount of information in the online help about using other packages and building your own.
 

1. What is the difference between Mathematica and MATLAB?

Both Mathematica and MATLAB are powerful computational software used for scientific and technical computing. However, there are some key differences between the two. Mathematica is a complete programming language that includes symbolic and numerical computation, while MATLAB is primarily a numerical computing environment. Additionally, Mathematica has a wider range of built-in functions and is better suited for data analysis and visualization, while MATLAB is more commonly used for mathematical modeling and simulation.

2. Can I use Mathematica as a replacement for MATLAB?

While Mathematica has many similar functions and capabilities as MATLAB, it may not be a perfect replacement. It ultimately depends on the specific tasks and applications you need to perform. It is recommended to try out both software and see which one better suits your needs.

3. Does Mathematica have a function similar to MATLAB's "for loop"?

Yes, Mathematica has a "For" function that can be used similarly to MATLAB's "for loop". However, Mathematica also has other looping functions, such as "Do" and "While", which may be more efficient for certain tasks.

4. How do I import and export data in Mathematica?

Mathematica has a wide range of functions for importing and exporting data, such as "Import", "Export", and "ReadList". These functions support various file formats, including CSV, Excel, and HDF5. You can also use the "Table" function to manually input data into a Mathematica notebook.

5. Is Mathematica more expensive than MATLAB?

The cost of Mathematica and MATLAB can vary depending on the type of license and any additional toolboxes or add-ons. In general, Mathematica may be slightly more expensive, but it also offers a free version called Wolfram|One for personal use. It is recommended to check the pricing options for both software to determine which one is more cost-effective for your specific needs.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
7
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
146
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
270
  • MATLAB, Maple, Mathematica, LaTeX
Replies
3
Views
1K
Back
Top