Questions tagged [matlab]

MATLAB is a high-level language and interactive programming environment for numerical computation and visualization developed by MathWorks. Don’t use both the [matlab] and [octave] tags, unless the question is explicitly about the similarities or differences between the two. When using this tag, please mention the MATLAB release you're working with (e.g. R2017a).

MATLAB (Matrix Laboratory) is a high-level language and interactive programming environment for numerical computation and visualization, developed by MathWorks. MATLAB can be used when performing tasks such as signal processing and communications, image and video processing, computational finance, and computational biology. It is the foundation for a number of other tools, including Simulink and various toolboxes that extend its core capabilities.

MATLAB is a cross-platform system developed since 1984. From the release of version 7.2 (R2006a) there has continued to be a biannual release cycle, with version "a" typically released in March/April and version "b" in September/October - based on the release history. For example R2017a and R2017b were the two releases in 2017.

MATLAB is a proprietary product of MathWorks. This means that, unlike open source languages, both programmers and users must own a valid software license in order to run MATLAB code.

There are several open source alternatives to MATLAB, in particular GNU Octave, which offers (mostly) bidirectional syntactic compatibility with MATLAB, Scilab, SciPy, and Julia.

Documentation

Informative links that show up quite often in answers##

  • Release notes for all versions.
  • MATLAB Central File Exchange: a repository of user-contributed MATLAB tools
  • MATLAB Add-Ons: Add-Ons for MATLAB
  • MATLAB Central blogs: usually updated weekly by a number of MathWorks employees
  • Undocumented MATLAB: "Charting MATLAB’s unsupported hidden underbelly"
  • MATLAB Answers: a collaborative environment for getting answers to questions about MathWorks products, similar to Stack Overflow
  • comp.soft-sys.matlab Usenet group: can be accessed online through Google Groups
  • MATLAB Cody™ is a place where you can go to find a variety of MATLAB-based coding challenges that will help to expand your understanding of MATLAB.
  • MATLAB ThingSpeak™ is an open data platform and API for the Internet of Things that enables you to collect, store, analyze, visualize, and act on data gathered directly from sensors or from other web sources. With ThingSpeak and its built-in MATLAB Analysis and MATLAB Visualizations apps, you can create custom trends and plots.
  • MATLAB Online: Online version of MATLAB (available to licensed users only). Octave Online is a free alternative based on the open source GNU Octave which is (pretty much) compatible with MATLAB.
  • MATLAB on Stack Overflow chat: Chat room for users of MATLAB and Octave
94593 questions
10
votes
3 answers

What does %#ok comment mean in MATLAB?

I've encountered many MATLAB codes which have a %#ok comments. This comment is used in different circumstances and I can't figure it out what it means. As an example: i = 1; flag = true; for l = 1:k while(flag==true) …
Isaac
  • 2,332
  • 6
  • 33
  • 59
10
votes
2 answers

Greatest common divisor of multiple (more than 2) numbers

I am seeking for the easiest solution to get the greatest common divisor of multiple values. Something like: x=gcd_array(30,40,35) % Should return 5 x=gcd_array(30,40) % Should return 10 How would you solve this? Many thanks!
Caniko
  • 867
  • 2
  • 11
  • 28
10
votes
4 answers

Text progress bar in Matlab

I've got a Matlab function that takes some time to run, and I'd like to show the user that progress is being made. Just disping the progress every 5% or so would clutter the screen too much, as the previous text would not be erased. How can this…
Andreas
  • 7,470
  • 10
  • 51
  • 73
10
votes
3 answers

Is there a Matlab loop equivalent to python's "for in" loop?

Is there a matlab equivalent of the "for in" loop in python? For instance in python, I can iterate through items of a list using the following code: for c_value in C_VALUES:
stressed_geek
  • 2,118
  • 8
  • 33
  • 45
10
votes
5 answers

MATLAB graph plotting: assigning legend labels during plot

I am plotting data in a typical MATLAB scatterplot format. Ordinarily when plotting multiple datasets, I would use the command 'hold on;', and then plot each of the data, followed by this to get my legend: legend('DataSet1', 'DataSet2') %…
CaptainProg
  • 5,610
  • 23
  • 71
  • 116
10
votes
2 answers

Saving a plot as a PNG in Matlab

I have a function that is plotting a time series, now I want to save this as an image how can this be done please? function TimeSeriesImages(a, b, c, d, e, f, g, h, i, j, k, l) x = [a b c d e f g h i j k l]; ts1 = timeseries(x,1:12); ts1.Name =…
Xupla
  • 201
  • 2
  • 4
  • 14
10
votes
2 answers

Word wrap in MATLAB editor

How can I word-wrap long lines of scripts and functions in the MATLAB R2011b Editor? I don't mean using Ctrl+J to wrap comments, but show a long line over several lines, each (except the last) the width of the editor frame, as in most text editors,…
Gnubie
  • 2,587
  • 4
  • 25
  • 38
10
votes
3 answers

Create a correlation graph in Matlab

I'm trying to emulate this graph: If I have a correlation matrix how can I create an output like this?
zpesk
  • 4,343
  • 7
  • 39
  • 61
10
votes
4 answers

bandpass butterworth filter implementation in C++

I am implementing an image analysis algorithm using openCV and c++, but I found out openCV doesnt have any function for Butterworth Bandpass filter officially. in my project I have to pass a time series of pixels into the Butterworth 5 order filter…
user261002
  • 2,182
  • 10
  • 46
  • 73
10
votes
4 answers

how to find the similarity between two curves and the score of similarity?

I have two data sets (t,y1) and (t,y2). These data sets visually look same but their is some time delay or magnitude shift. i want to find the similarity between the two curves (giving the score of similarity 1 for approximately similar curves and 0…
user1364183
  • 101
  • 1
  • 1
  • 3
10
votes
8 answers

How do I convert a MATLAB image processing program to java?

I've written an image processing program in MATLAB which makes heavy use of the MATLAB Image Processing Toolbox, especially the morphological operations (imopen, imclose) as well as imadjust. We do a lot of spline fit operations and medfilt2 and…
Joe Soul-bringer
  • 3,294
  • 5
  • 31
  • 37
10
votes
2 answers

Indexing of unknown dimensional matrix

I have a non-fixed dimensional matrix M, from which I want to access a single element. The element's indices are contained in a vector J. So for example: M = rand(6,4,8,2); J = [5 2 7 1]; output = M(5,2,7,1) This time M has 4 dimensions, but this…
Gunther Struyf
  • 11,158
  • 2
  • 34
  • 58
10
votes
3 answers

Can a Matlab PARFOR loop be programmatically switched on/off?

Have a simple question about parfor in MATLAB. I would like to set a flag in my program to change between parfor and regular for loops. Basically, I need this functionality so that some parts of my code can update graphics in a "debug" mode, then…
Kyle Lynch
  • 235
  • 1
  • 3
  • 6
10
votes
2 answers

Is 'Ctrl' key pressed while clicking a button?

I need to know whether the user is holding down the ctrl key while clicking a button. Since it's a button and not a figure I cannot use 'selectionType' on the figure etc.
codekitty
  • 1,438
  • 3
  • 20
  • 30
10
votes
2 answers

scaling the testing data for LIBSVM: MATLAB implementation

I currently use the MATLAB version of the LIBSVM support vector machine to classify my data. The LIBSVM documentation mentions that scaling before applying SVM is very important and we have to use the same method to scale both training and testing…
Lily
  • 315
  • 2
  • 6
  • 16
1 2 3
99
100