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
92
votes
6 answers

Hash tables in MATLAB

Does MATLAB have any support for hash tables? Some background I am working on a problem in Matlab that requires a scale-space representation of an image. To do this I create a 2-D Gaussian filter with variance sigma*s^k for k in some range., and…
Nathan Fellman
  • 122,701
  • 101
  • 260
  • 319
92
votes
7 answers

LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MD_DynamicRelease' in file.obj

I am Integrating Matlab, C and Cuda together in a project. I used Matlab mix in order to connect matlab mx function written in c with the cuda runtime library, a linking error appear about conflict in static release and dynamic release between the c…
Ahmed Hassan
  • 961
  • 1
  • 6
  • 3
91
votes
2 answers

cocktail party algorithm SVD implementation ... in one line of code?

In a slide within the introductory lecture on machine learning by Stanford's Andrew Ng at Coursera, he gives the following one line Octave solution to the cocktail party problem given the audio sources are recorded by two spatially separated…
gregS
  • 2,580
  • 5
  • 28
  • 33
87
votes
8 answers

How do I iterate through each element in an n-dimensional matrix in MATLAB?

I have a problem. I need to iterate through every element in an n-dimensional matrix in MATLAB. The problem is, I don't know how to do this for an arbitrary number of dimensions. I know I can say for i = 1:size(m,1) for j = 1:size(m,2) …
rlbond
  • 65,341
  • 56
  • 178
  • 228
85
votes
11 answers

Why/when should I prefer MATLAB over Octave?

In our shoestring operation we need to prototype algorithms in some higher-level language before committing to a C implementation on embedded hardware. So far we have been using MATLAB to do that, but the licensing costs are beginning to hurt. We're…
lindelof
  • 34,556
  • 31
  • 99
  • 140
84
votes
7 answers

In MATLAB, can I have a script and a function definition in the same file?

Suppose I have a function f() and I want to use it in my_file.m, which is a script. Is it possible to have the function defined in my_file.m? If not, suppose I have it defined in f.m. How do I call it in my_file.m? I read the online documentation,…
Viktor
  • 841
  • 1
  • 6
  • 3
83
votes
10 answers

MatLab error: cannot open with static TLS

Since a couple of days, I constantly receive the same error while using MATLAB which happens at some point with dlopen. I am pretty new to MATLAB, and that is why I don't know what to do. Google doesn't seem to be helping me either. When I try to…
Hans Meyer
  • 931
  • 1
  • 7
  • 4
82
votes
6 answers

How to concat string + i?

for i=1:N f(i) = 'f'+i; end gives an error in MatLab. What's the correct syntax to initialize an array with N strings of the pattern fi? It seems like even this is not working: for i=1:4 f(i) = 'f'; end
simpatico
  • 10,709
  • 20
  • 81
  • 126
81
votes
5 answers

Python equivalent to 'hold on' in Matlab

Is there an explicit equivalent command in Python's matplotlib for Matlab's hold on? I'm trying to plot all my graphs on the same axes. Some graphs are generated inside a for loop, and these are plotted separately from su and sl: import numpy as…
Medulla Oblongata
  • 3,771
  • 8
  • 36
  • 75
79
votes
7 answers

How to set the DPI of Java Swing apps on Windows/Linux?

If you have an monitor with a DPI over 150 (such as Macbook Pro), you may also find the problem: the font on the Java Swing app is too small for high DPI monitor, and I cannot change the font size at all ( It ignores the Windows DPI directly, only…
Searene
  • 25,920
  • 39
  • 129
  • 186
77
votes
7 answers

Changing Fonts Size in Matlab Plots

I want to change Font Size for xlabel, ylabel, axis size, legend font size a.k.a everything at once, is this possible? By default, font is Helvetica 10. Is there way to change this? I want to use 'FontSize',14, for x or y labels.
sosruko
  • 1,069
  • 2
  • 11
  • 13
77
votes
4 answers

Iterating through struct fieldnames in MATLAB

My question is easily summarized as: "Why does the following not work?" teststruct = struct('a',3,'b',5,'c',9) fields = fieldnames(teststruct) for i=1:numel(fields) fields(i) teststruct.(fields(i)) end output: ans = 'a' ??? Argument to…
noio
  • 5,744
  • 7
  • 44
  • 61
77
votes
13 answers

Call Python function from MATLAB

I need to call a Python function from MATLAB. how can I do this?
Sarah
  • 1,361
  • 2
  • 14
  • 20
77
votes
3 answers

Octave/Matlab: Adding new elements to a vector

Having a vector x and I have to add an element (newElem) . Is there any difference between - x(end+1) = newElem; and x = [x newElem]; ?
URL87
  • 10,667
  • 35
  • 107
  • 174
76
votes
4 answers

How to change the window title of a MATLAB plotting figure?

I have created a MATLAB plotting with the plot() function. How do I change the window title of the generated figure of the plotting? My MATLAB m-file which I'm working on: hold on x = [0; 0.2; 0.4; 0.6; 0.8; 1; 1.2; 1.4; 1.6; 1.8; 2; 2.2; 2.4; 2.6;…
hkBattousai
  • 10,583
  • 18
  • 76
  • 124