Respondida
Need help with the code.
Try this. shuffletext2([1 2; 3 4; 5 6], 'orange') function [intext] = shuffletext2(pairs,intext) for p = 1:size(pairs,...

más de 4 años hace | 0

Respondida
Custom colorbar with predefined ticks
The answer I gave in your last question addressed this issue in part (at least for linear scales). For an arbitrary scale, you ...

más de 4 años hace | 1

| aceptada

Respondida
why if elseif statement is not working
It's doing exactly what you're telling it to do. Look at the range of the data. Look at the logical tests you're doing. Case ...

más de 4 años hace | 1

Pregunta


A better way to do antidiagonal matrix vectorization?
Say I want to reduce a MxN matrix to a column vector, consisting of all antidiagonal vectors. Consider the 5x5 matrix: A = res...

más de 4 años hace | 3 respuestas | 0

3

respuestas

Respondida
How do I get for loop to stop creating matrix when it reaches the correct size?
I'm just going to assume the intent is something like this: N = 28; vc = [4 -1 zeros(1,N-2) -1 zeros(1,N^2-N-1)]; vr = [4 -1 ...

más de 4 años hace | 0

Respondida
Use for loop with Circshift to generate Pentadiagonal matrix
You ask for a pentadiagonal matrix, but what you describe has only three nonzero diagonals, and they aren't centered on the main...

más de 4 años hace | 1

Respondida
Pixelwise brightness adjustment using another image (weights)
This might be of use as an example. The original image has large flat regions of solid color, but the weighted image does not. ...

más de 4 años hace | 0

Respondida
What mistake I am making?
Try this m = [ 2 14 28 -7 5 ]; avgpositive7multiples_for(m) function [avg] = avgpositive7multiples_for(m) m = m(m >= ...

más de 4 años hace | 0

Respondida
summation of a matrix inside circle
This should work regardless of whether N is odd or even. s = 100; A = ones(s); % test array % build distance map rmax = s/...

más de 4 años hace | 0

| aceptada

Respondida
Legend with 15 colors
I don't know what your plot type is, but consider the contourf example: % the given colormap cmap = [0.851 0.851 0.851;0.498 1...

más de 4 años hace | 0

Respondida
How do I write pdf of random variable?
The PDF for uniform random numbers is just a simple piecewise-constant function. Consider uniform random numbers with a lower b...

más de 4 años hace | 0

Respondida
Issues with morphological closing of a binary image?
Did you notice that your thresholded image is inverted? By trying to close the inverted image, you're trying to remove the wron...

más de 4 años hace | 0

| aceptada

Respondida
Vectorization not working in Matlab - Matrix dimensions do no agree?
It can be simpler than that. % original T = eye(3); vec_1 = [4,5,6]; vec_2 = [7,8,9]; tot = 0; for m=1:3 for n=1:3 ...

más de 4 años hace | 0

Respondida
Extract substring in right format
Why include the extra _? str = 'Subject160/VSTMB_160_band_resample/data_22_right_average_210225_1827.mat' EventName = regexp(s...

más de 4 años hace | 0

| aceptada

Respondida
how can i obtain this?
I'm assuming that you want all 71 columns to be extracted in the same fashion. Consider the example: % 5x5x3 array A = cat(3,...

más de 4 años hace | 0

Respondida
Extract X, Y and Z data from contour plot in JPEG format.
This is a routine question, it seems. This is the answer as I see it. https://www.mathworks.com/matlabcentral/answers/146003...

más de 4 años hace | 0

Respondida
How to interpolate attached data with the interval of 0.1524?
Something like this: DP = readmatrix('DepthVSpressure.txt'); D_refined = min(DP(:,1)):0.1524:max(DP(:,1)); P_refined = inte...

más de 4 años hace | 0

Respondida
For loop each RGB image channel
There are probably more succinct ways, but this is one way. Instead of creating a pile of variables, just put things in an arra...

más de 4 años hace | 1

| aceptada

Respondida
how to rotate integer vector from right to left and vis versa
Something like this shamount = 1; % amount to shift left (negative to shift right) A = 1:5 % test vector B = circshift(A,[0...

más de 4 años hace | 0

| aceptada

Respondida
Why is there no line on my plot ?
Use the entire vector instead of the last element. plot(prcp_rad,LSyield);

más de 4 años hace | 0

Pregunta


Dealing with dead newsreader links on the forum
There are countless comments and answers on the forum which link to old Mathworks newsreader threads. Of course we all know tha...

más de 4 años hace | 0 respuestas | 2

0

respuestas

Respondida
How do we upsample a colour image by 0.25 and 0.5 without using imresize() function ???
Direct subscript indexing isn't going to work, since there are no fractional indices in an array. lena_quarterup = lena_q(1:l...

más de 4 años hace | 0

Respondida
View individual components of NTSC (Y, I and Q) image
You need to assume some nominal Y and then convert back to RGB. A = imread('YIQ_components.jpg'); % original barn image monta...

más de 4 años hace | 0

Respondida
Save and Load a matrix
I don't know why nobody has thrown an answer here, but here goes. The output argument of load() is a struct. You either use ...

más de 4 años hace | 0

Respondida
Using a variable to help fill in the legend line on a plot
You can use sprintf() to construct a bit of text from numeric variables or other string/char variables. Then you can use that i...

más de 4 años hace | 0

Respondida
how to add a corresponding colorbar with a plot lines
Just flip the colormap. y=1+rand(10,10)*9; col = ones(10,3).*rand(10,1); col = sort(col,'ascend'); plot([1 10],[1 10]); h...

más de 4 años hace | 0

| aceptada

Respondida
I want to put the numerical values in a 19x2 matrix and ignore the text before the numbers
You can start with textscan() fID = fopen('AER309 Lab 4 - CpData.txt', 'r'); M = textscan(fID, '%f %f','HeaderLines',3) fclos...

más de 4 años hace | 1

| aceptada

Respondida
When using fspecial my figure/picture just ends up as a blue square?
You're probably starting out with a uint8-scaled image and casting it as double. At that point, you can do whatever you want wi...

más de 4 años hace | 2

Respondida
Remove white space from around image
It's never too late for reference answers ... Reading the question, I assume that the intent is to crop the excess padding from...

más de 4 años hace | 1

Respondida
How do I add a black border around an image?
Rik already gave the non-IPT and IPT methods. I'm just going to add a bunch of examples for a more generalized reference coveri...

más de 4 años hace | 0

Cargar más