Thilina's Blog

I might be wrong, but…

MATLAB GUI programming (code level) 2.0 – Undocumented MATLAB – JAVA codes in MATLAB M-files


This is something I found really interesting in MATLAB. We can write m-scripts with JAVA codes, this is very useful when designing UI components for MATLAB applications. In this article I will share my experience on creating GUI in MATLAB using JAVA and also an implementation of video cropping software (backend part will be discussed on my next article).

For more information on Undocumented MATLAB, please visit Undocumented MATLAB official web page.

When using JAVA codes in *.m files we do not use “new” keywords to initiate any objects.  I am not sure the usage of import keyword in MATLAB/JAVA. Therefore JFrame must be used as  java.swing.JFrame. It is quite different from JAVA.

JFrame frame = new JFrame; // Java Syntax
frame = javax.swing.JFrame; % matlab syntax

Continue reading

Advertisements

2012 May 30 Posted by | Java, MATLAB | , , , , , , | 8 Comments

Sorting Algorithms sample codes on JAVA, C++ and MATLAB


Sorting is the process which puts the elements in a list to an order. Sorting algorithms are used to optimize the performance and resources usage in computer science. Since I was interested to work with C++ I decided to implement some of those algorithms to be familiar with the language, but later on I thought it may be useful to implement those in JAVA as well as in MATLAB. From this article I am going to share my experiences in implementing those codes in above languages. I used Wikipedia, sorting algorithms website and the book “Introduction to Algorithms 3e” as my references. The algorithms I implemented was,

  1. Selection Sort
  2. Insertion Sort
  3. Bubble Sort
  4. Quick Sort
  5. Merge Sort
  6. Shell Sort

Sample codes will be as below. In MATAB, this can be used to compare any numeric data type such as uint8, uint16, int8, int16, double, etc. But in case of JAVA and C++ I wrote them to work with integers. Since I am new to C++ I some good points in using arrays/pointers with C++, such as how to initialize an array with a length which is an argument of that function, to get the size of an array, etc. These codes may not be the optimised codes for above algorithms but a small attempt to implement those on three platforms.

Continue reading

2011 June 1 Posted by | C++, Java, MATLAB | 25 Comments

   

%d bloggers like this: