This question already has answers here:
xaxis/yaxis lines in matlab plot
(2 answers)
How to add a x-axis line to a figure? (matlab)
(6 answers)
Closed 3 months ago.
I want to plot the mean of a data measurement with the standard deviation along the x-axes. I tried using boundedline, but it is not working. I have just one value (y value) with the corresponding standard error to plot across the x values. Can someone know how to do it?
boundedline.m - File Exchange - MATLAB Central (mathworks.com)
This question already has an answer here:
Image Pixel values
(1 answer)
Closed 6 years ago.
I want to store all pixel values of an image in either in an array or in a vector using matlab. Please suggest me how can I do it?
Probably what seems is you want to store the image in 1D, which can be done as:
I = imread('cameraman.tif');
I_1D = I(:);
you also take the transpose of this vector as I_1D = I(:)';
This question already has answers here:
Reshaping of Array in MATLAB
(3 answers)
Closed 7 years ago.
I have the following matrix:
50,60,55,67,70
62,65,70,70,81
72,66,77,80,69
I turn now the matrix into a vector but in row-major. This gives the following vector:
50,60,55,67,70,62,65,70,70,81,72,66,77,80,69
Now I would like to turn this vector into the same matrix as above. The problem is that reshape(matrix,[3,5]) does not work because Matlab operates column-major.
How can this be done efficiently (for large matrices)?
To solve this, use
reshape(matrix,[5,3]).'
First using reshape with row and column dimension swapped, you get a matrix with the right order but transposed, then using transpose you get the right output.
Having the control systems toolbox, you could also use vec2mat
This question already has an answer here:
Draw network or graph from matrix in matlab
(1 answer)
Closed 7 years ago.
I have an adjacency matrix and corresponding labels. I need to plot a network with weighted edges and different colors based on labels. I found there is gplot function in matlab, but it is not created weighted edges. Does anyone know any toolbox or function or something I can use?
There is a tool called wgPlot by Mike Wu that will allow you to plot weighted adjacency graphs easily.
wgPlot by MikeWu
Note that the edges are not labeled textually, but by a color scale.
This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
Matlab 3D Matrix Plot
I have a matrix in matlab that I want to plot as a 3D figure.
Suppose the matrix looks like the following:
A=[4 7 8; 2 3 9 ]
This actually means the following data points in x,y,z plane
(1,1,4) (1,2,7) (1,3,8) (2,1,2) (2,2,3) (2,3,9)
I want to plot these values on a 3D graph.
How can I do that?
The function to use is surf(A)
This will plot your points from x = 1:2 and y = 1:3