Brought to you by MSB Solutions

MSB Solutions is available for building MATLAB functions and GUI's for your application. We have a combined background in optimization, digital signal processing (DSP), statistical analysis, display/interpretation of sensor data. Contact us for more information.

MSB Solutions is not affiliated with MathWorks in any way, and all functions and examples provided here are to be used at your own risk.

Recent posts

Archives

Tags

array arrays cell cell array cells compiled compiler compiling consulting cuts dark default development editor element encrypted font function GUI GUI's GUIDE help installation installer MathWorks MATLAB matrices matrix mbuild mcc multiplication NSIS Nullsoft point wise pointwise quit debugging R2007a R2007b sensors settings short shortcuts template theme XML

Recent Comments

Meta

Site search

Categories

February 2012
M T W T F S S
« Jun    
 12345
6789101112
13141516171819
20212223242526
272829  

Archive

MATLAB Consulting for Data Analysis and Statistics

Our team is available for MATLAB development consultation.  We have created our own set of tools for

  • Digital signal processing (DSP) – Analysis of data from motion sensors (accelerometers, gyroscopes, magnetometers), force plates, audio.  Also, we have considerable background in different filter types including IIR and FIR digital filters, zero-phase filtering, and Kalman filters.
  • Statistics – We can analyze any set of data for correlation or regression equations.
  • Interface development (GUIDE) for your functions
  • Compiling your interfaces or functions for distribution
  • General MATLAB development efficiency tools

Contact us for more information or a quote for your project from one of our consultants.

Element by element arithmetic operators in MATLAB

One of the most important basics of MATLAB is to understand how to use element-by-element (or “point-wise”) arithmetic operators for multiplying arrays or matrices. The following are some examples of the logic behind the element-by-element operator, and you are expected to understand basic linear algebra for this to make sense.

Element-wise multiplication

Notice (in the first example) that [1 3 7]*[1; 3; 7] could be written as [1 3 7]*[1 3 7].  Notice in the third example that [1 3 7]*[1 3 7] could be written as [1 3 7]^2 which will also produce an error.

I think this these examples are fairly self-explanatory, but just understand your goals keeping what you learned in math class in mind. You can access MATLAB’s documentation for the element-by-element operator by typing “doc”, and searching for “arithmetic operators”.

Subplots in MATLAB GUIDE using panels instead of axes

If you have ever been confused with using subplots in MATLAB GUIDE, you are not alone. Using an axes object does not allow for subplots like in a regular MATLAB function or script. Here is a workaround:

  1. In your interface, use a “panel” instead of an “axes”.
  2. Set your panel’s tag name to “pnlMyPlot”
  3. In your code, identify your plot target with
    subplot(1,1,1,'Parent',handles.pnlMyPlot)
  4. Then, code your plot or subplot like normal. For example:
    subplot(2,1,1)
    hold on
    plot(rand(10,1))
    ylabel('Y axis label')
    xlabel('X axis label')
    title('10 random numbers')
    hold off

The attached example demonstrates using a panel instead of an axes for plotting in your interface. If you look at the code for each button, try uncommenting the code for a logical subplot using an axes, and check out what happens. Extract the two files into your MATLAB work directory. Subplots in GUIDE example