Answered

Error Handling Question: How to Loop Until User Enters NUMBERS(!) in GUIDE gui edit boxes and then presses an "Update" button

Possibly, you ought to simply exit your callback function if the input is invalid? The values will then only be stored in your a...

Error Handling Question: How to Loop Until User Enters NUMBERS(!) in GUIDE gui edit boxes and then presses an "Update" button

Possibly, you ought to simply exit your callback function if the input is invalid? The values will then only be stored in your a...

7 months ago | 0

| accepted

Answered

giving color to output result

If you mean output to the command window, see this file exchange contribution from Yair Altman: https://www.mathworks.com/matla...

giving color to output result

If you mean output to the command window, see this file exchange contribution from Yair Altman: https://www.mathworks.com/matla...

7 months ago | 0

Answered

why there is only one value at my plot

Without the below period, MATLAB is performing right matrix division on two 1x151 vectors, resulting in a scalar value. t = 0:0...

why there is only one value at my plot

Without the below period, MATLAB is performing right matrix division on two 1x151 vectors, resulting in a scalar value. t = 0:0...

7 months ago | 2

Answered

How can I extract curve data from a .FIG file?

You could use findobj() on each figure to find the handles of the two lines. You can differentiate the lines by their LineStyles...

How can I extract curve data from a .FIG file?

You could use findobj() on each figure to find the handles of the two lines. You can differentiate the lines by their LineStyles...

7 months ago | 0

Answered

Options for displaying data by clicking on a marker in a plot

For R2018b and later: X = rand(10,1); Y = rand(10,1); IDs = randi(100,10,1); s = scatter(X, Y, 'x'); s.DataTipTemplate.Da...

Options for displaying data by clicking on a marker in a plot

For R2018b and later: X = rand(10,1); Y = rand(10,1); IDs = randi(100,10,1); s = scatter(X, Y, 'x'); s.DataTipTemplate.Da...

7 months ago | 0

| accepted

Answered

Operands to the || and && operators must be convertible to logical scalar values.

Use & instead for element-wise and (or | for element-wise or): whitePixels=ext_rows((150<ext_rows) & (ext_rows<200));

Operands to the || and && operators must be convertible to logical scalar values.

Use & instead for element-wise and (or | for element-wise or): whitePixels=ext_rows((150<ext_rows) & (ext_rows<200));

7 months ago | 0

| accepted

Answered

How to plot log-scale with number ?

Maybe something like this? % data: X = 2*logspace(1, 3, 100); Y = rand(100,1); % labels to keep: labels = [20 30 50 70 10...

How to plot log-scale with number ?

Maybe something like this? % data: X = 2*logspace(1, 3, 100); Y = rand(100,1); % labels to keep: labels = [20 30 50 70 10...

7 months ago | 1

| accepted

Answered

creating a new matrix without certain rows with elements below a certain value

If I'm understanding correctly, I believe your third line is enough (with the addition of a colon in the second subscript of M t...

creating a new matrix without certain rows with elements below a certain value

If I'm understanding correctly, I believe your third line is enough (with the addition of a colon in the second subscript of M t...

7 months ago | 0

| accepted

Answered

Access .mlapp data in .m file after app closes

Rather than waitfor(H), which waits until H is deleted, how about waitfor(H,propname,propvalue), where propname is some property...

Access .mlapp data in .m file after app closes

Rather than waitfor(H), which waits until H is deleted, how about waitfor(H,propname,propvalue), where propname is some property...

8 months ago | 1

| accepted

Answered

Find set of all adjacent points that are close to each other

How about this? logidx = abs(diff(Y)) < 0.022; Y_adj_close = Y([logidx 0] | [0 logidx]); Y_adj_close = 1.1000 1.1...

Find set of all adjacent points that are close to each other

How about this? logidx = abs(diff(Y)) < 0.022; Y_adj_close = Y([logidx 0] | [0 logidx]); Y_adj_close = 1.1000 1.1...

8 months ago | 0

| accepted

Answered

How to find the peak value of a graph and how to plot them?

According to the findpeaks() documentation: "A local peak is a data sample that is either larger than its two neighboring sampl...

How to find the peak value of a graph and how to plot them?

According to the findpeaks() documentation: "A local peak is a data sample that is either larger than its two neighboring sampl...

8 months ago | 0

| accepted

Answered

How to assign NaN to consecutive elements of a vector, in intervals defined by a matrix

Try this: N = numel(x); idx = any((1:N >= z(:,1) & 1:N <= z(:,2))); x(idx) = NaN;

How to assign NaN to consecutive elements of a vector, in intervals defined by a matrix

Try this: N = numel(x); idx = any((1:N >= z(:,1) & 1:N <= z(:,2))); x(idx) = NaN;

8 months ago | 0

| accepted

Answered

Array dimensions must match for binary array op.

'cameraman.tif' and 'coins.png' are both grayscale, meaning your im is a NxM array and your code works. For any image with co...

Array dimensions must match for binary array op.

'cameraman.tif' and 'coins.png' are both grayscale, meaning your im is a NxM array and your code works. For any image with co...

8 months ago | 0

| accepted

Answered

select specific values from a matrix based on indeces

I believe this will give you the values you want: temp = reshape(iMxR, 15, [])'; idx = sub2ind(size(temp), 1:size(temp,1), ix)...

select specific values from a matrix based on indeces

I believe this will give you the values you want: temp = reshape(iMxR, 15, [])'; idx = sub2ind(size(temp), 1:size(temp,1), ix)...

8 months ago | 0

| accepted

Answered

Offsetting error bars on plot and showing both positive and negative values.

If you plot the errorbars after you plot the bars, then they will show on top of the bars and you will be able to see the error ...

Offsetting error bars on plot and showing both positive and negative values.

If you plot the errorbars after you plot the bars, then they will show on top of the bars and you will be able to see the error ...

8 months ago | 0

| accepted

Answered

Scatter plot with different color for points above the linear fit line

Here's a simple example using a linear regression, hopefully you find it helpful: % random data X = rand(100,1); Y = 0.5*X + ...

Scatter plot with different color for points above the linear fit line

Here's a simple example using a linear regression, hopefully you find it helpful: % random data X = rand(100,1); Y = 0.5*X + ...

8 months ago | 1

| accepted

Answered

Name a graph with the title of the sheets of excel

Perhaps like this? xlfile = 'RamYPabHumedad.xlsx'; [~, sheets] = xlsfinfo(xlfile); cmonths = 19; for i = 1:cmonths %itera...

Name a graph with the title of the sheets of excel

Perhaps like this? xlfile = 'RamYPabHumedad.xlsx'; [~, sheets] = xlsfinfo(xlfile); cmonths = 19; for i = 1:cmonths %itera...

8 months ago | 0

| accepted

Answered

How to eliminate colormap?

When you supply a 2D array to image(), the values within that array are mapped to a colormap. The colormap is needed to convert ...

How to eliminate colormap?

When you supply a 2D array to image(), the values within that array are mapped to a colormap. The colormap is needed to convert ...

8 months ago | 1

| accepted

Answered

How to make a log operation for a matrix excluding the '-inf' values?

k should span from 1 to size(IDHMA,2), similar to ii: for ii = 1: size (IDHMA,1) for kk = 1 : size (IDHMA,2) IDHMAlog (ii,...

How to make a log operation for a matrix excluding the '-inf' values?

k should span from 1 to size(IDHMA,2), similar to ii: for ii = 1: size (IDHMA,1) for kk = 1 : size (IDHMA,2) IDHMAlog (ii,...

8 months ago | 1

| accepted

Answered

How to make specific elements of a matrix zero before nth element?

Boring: C = A; for i = 1:size(A,2) C(1:B(i)-1,i) = 0; end Ugly: C = A; [N,M] = size(C); C(~any((1:N*M)'>=N*(0:M-1)+B...

How to make specific elements of a matrix zero before nth element?

Boring: C = A; for i = 1:size(A,2) C(1:B(i)-1,i) = 0; end Ugly: C = A; [N,M] = size(C); C(~any((1:N*M)'>=N*(0:M-1)+B...

8 months ago | 1

Answered

Create new variable with only values of a certain variable

Try this: idx = mutualInfoTotal >= 5; % indices of values at least equal to 5 mutualInfoTotal = mutualInfoTotal(idx);

Create new variable with only values of a certain variable

Try this: idx = mutualInfoTotal >= 5; % indices of values at least equal to 5 mutualInfoTotal = mutualInfoTotal(idx);

8 months ago | 0

| accepted

Answered

How to get the data as output along with the histogram plot?

You could request output from histogram(): h = histogram(S,'Normalization','probability'); and access properties such as h.Bin...

How to get the data as output along with the histogram plot?

You could request output from histogram(): h = histogram(S,'Normalization','probability'); and access properties such as h.Bin...

8 months ago | 2

| accepted

Answered

Finding pair values in a matrix

How about this? z = unique(sort(z,2),'rows');

Finding pair values in a matrix

How about this? z = unique(sort(z,2),'rows');

8 months ago | 0

Answered

Concatenating 2 vectors into 1 vector with the values adjacent to each other

Should February 2012 map to 20122 rather than 20121? If so, maybe this will do the trick? month = repmat((1:12)', 5, 1); year ...

Concatenating 2 vectors into 1 vector with the values adjacent to each other

Should February 2012 map to 20122 rather than 20121? If so, maybe this will do the trick? month = repmat((1:12)', 5, 1); year ...

8 months ago | 0

Answered

Define a plot object but do not show the plot

plot_temperature=plot(day, temperature, 'Visible', 'off'); plot_rainfall=plot(day, rainfall, 'Visible', 'off'); Or if you don'...

Define a plot object but do not show the plot

plot_temperature=plot(day, temperature, 'Visible', 'off'); plot_rainfall=plot(day, rainfall, 'Visible', 'off'); Or if you don'...

8 months ago | 0

| accepted

Answered

Change colour in stem plot, for only particuar values

You could overlay two separate stem plots: data = randi(10,10,1); idx = [4, 9]; ax = axes; hold(ax, 'on'); temp = data;...

Change colour in stem plot, for only particuar values

You could overlay two separate stem plots: data = randi(10,10,1); idx = [4, 9]; ax = axes; hold(ax, 'on'); temp = data;...

8 months ago | 0

| accepted

Answered

How to draw 2 different plot on a graph

hold on or set(gca, 'NextPlot', 'add') in between your calls to plot or however you are plotting.

How to draw 2 different plot on a graph

hold on or set(gca, 'NextPlot', 'add') in between your calls to plot or however you are plotting.

8 months ago | 0

Answered

MATLAB GUI: How do I pass image matrix into function

In appdesigner, first make sure you are in code view: Then in the code browser on the left side, go to the tab labeled Proper...

MATLAB GUI: How do I pass image matrix into function

In appdesigner, first make sure you are in code view: Then in the code browser on the left side, go to the tab labeled Proper...

8 months ago | 0

| accepted

Answered

How do I change axes font (heatmap)?

Your code is crashing at this line: h.xlabel('FontName', 'Times New Roman'); The x label is set properly because of the previo...

How do I change axes font (heatmap)?

Your code is crashing at this line: h.xlabel('FontName', 'Times New Roman'); The x label is set properly because of the previo...

8 months ago | 1

| accepted

Answered

how to debugg the error : size input must be integers

nx = 1.5; % Number of grid points x-direction ny = 0.5; % Number of grid points in the y direction "size input must be integ...

how to debugg the error : size input must be integers

nx = 1.5; % Number of grid points x-direction ny = 0.5; % Number of grid points in the y direction "size input must be integ...

8 months ago | 0

| accepted