Comparison of C++, Java, Python, Ruby and MATLAB OOP Example
版本 1.14.0.4 (13.6 KB) 作者:
Stuart McGarrity
RedBlack Tree Binary Search Example Used to Compare of C++, Java™, Python, Ruby and MATLAB® Code
编者注: This file was selected as MATLAB Central Pick of the Week
This example adds MATLAB® to the list of languages in this C++ vs Java vs Python vs Ruby: a first impression article (http://web.archive.org/web/20100420080552/http://www.dmh2000.com/cjpr/ ), which compares implementations of a Red Black Tree binary search algorithm (http://www.cs.auckland.ac.nz/software/AlgAnim/red_black.html ).
The side by side code comparison shows the same simple object oriented example written in C++, Java, Python, Ruby and MATLAB. The MATLAB implementation uses the new object oriented features available in R2008a. This example is designed to help programmers familiar with these other languages learn object oriented programming practices in MATLAB.
How to Compare the Languages
Click download, then save and unzip the files to a folder. Open the comparelanguages.html file. The code for two languages is displayed side-by-side in two frames. You select which two languages to compare by clicking on the links at the top of each frame. Note that, unlike most of the other languages, you cannot currently put more than one class in a single MATLAB class definition file, so a fake combined file with the two classes and the test function (that does not run) is used for the side-by-side HTML comparison. The MATLAB code is contained in the sub folder called MATLAB_Code. The equivalent C++, Java, Python and Ruby code was available from the dmh2000 web site.
Although this example does let you compare the object oriented syntax of these languages, it does not compare the languages' ability to develop technical computing applications such as for signal processing, image processing, financial modeling, etc, for which MATLAB is designed.
Other resources for learning object orient programming in MATLAB include:
* Defining Classes Video Tutorial - 11 min (https://www.mathworks.com/videos/developing-classes-overview-101452.html )
* Comparison of C++ and MATLAB Using Object Oriented Application Example (http://tinyurl.com/2zkhgu )
* MATLAB Classes and Object Oriented Programming Documentation (https://www.mathworks.com/help/matlab/object-oriented-design-with-matlab.html )
For more information on MATLAB OOP, see product page: https://www.mathworks.com/products/matlab/object-oriented-programming.html
引用格式
Stuart McGarrity (2024). Comparison of C++, Java, Python, Ruby and MATLAB OOP Example (https://www.mathworks.com/matlabcentral/fileexchange/18972-comparison-of-c-java-python-ruby-and-matlab-oop-example), MATLAB Central File Exchange. 检索时间: .
MATLAB 版本兼容性
创建方式
R2008a
兼容任何版本
平台兼容性
Windows macOS Linux类别
- MATLAB > Software Development Tools >
- MATLAB > External Language Interfaces > Python with MATLAB > Call Python from MATLAB >
在 Help Center 和 MATLAB Answers 中查找有关 Software Development Tools 的更多信息
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!comparelanguages/MATLAB_Code
版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.14.0.4 | Fixed broken link |
||
1.14.0.3 | Edited description. |
||
1.14.0.2 | Fixed broken links |
||
1.14.0.1 | Updated license |
||
1.14.0.0 | Added link to more information. |
||
1.11.0.0 | Fix error in HTML formatting. |
||
1.10.0.0 | Url edit to comparelanguages.html |
||
1.9.0.0 | Description edits |
||
1.8.0.0 | Edits to url listing |
||
1.6.0.0 | Trademark work. |
||
1.1.0.0 | Added trademarks. |
||
1.0.0.0 | Corrected mistake in comments, found by reviewer, referring to 'anonymous' class |