Top "Matlab" questions

MATLAB is a high-level language and interactive programming environment for numerical computation and visualization developed by MathWorks.

Get the indices of the n largest elements in a matrix

Suppose I have the following matrix: 01 02 03 06 03 05 07 02 13 10 11 12 32 01 08 03 And I want the indices of the top 5 elements (in this case, 32, 13, 12, 11, 10). What is …

matlab matrix
How to draw an arrow in Matlab?

I'm trying to draw an arrow in matlab graph, without any success. Code example: function [ output_args ] = example( input_args ) …

matlab plot matlab-figure
What is the difference between .m and .mat files in MATLAB

When I traced my reference MATLAB script, I found files with the .mat extension. My questions are: What is the …

matlab file-io file-extension
Display matrix with row and column labels

Is there a convenient way to display a matrix with row and column labels in the Matlab terminal? Something like …

matlab matrix tabular matlab-table
How to assign values to a MATLAB matrix on the diagonal?

Suppose I have an NxN matrix A, an index vector V consisting of a subset of the numbers 1:N, and …

matlab vectorization
How do I get the handles of all open figures in MATLAB

I have nine open figures in matlab (generated by another function) and I want to print them all to file. …

matlab matlab-figure figures
Map function in MATLAB?

I'm a little surprised that MATLAB doesn't have a Map function, so I hacked one together myself since it's something …

matlab functional-programming map-function
How can I index a MATLAB array returned by a function without first assigning it to a local variable?

For example, if I want to read the middle value from magic(5), I can do so like this: M = magic(5); …

matlab indexing matrix return-value variable-assignment
Get rid of the white space around matlab figure's pdf output

I'd like to use PDF versions of my matlab plots in a LaTeX document. I'm saving the figures using the "…

pdf matlab
Declaring a global variable in MATLAB

Is there a way to declare global variables in MATLAB? Please don't respond with: global x y z; Because I …

matlab global-variables