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...

28 Tage 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...

28 Tage 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;

29 Tage 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...

29 Tage 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)...

29 Tage 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 ...

29 Tage 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 + ...

29 Tage 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...

30 Tage 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 ...

30 Tage 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,...

etwa ein Monat 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...

etwa ein Monat 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);

etwa ein Monat 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...

etwa ein Monat 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');

etwa ein Monat 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 ...

etwa ein Monat 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'...

etwa ein Monat 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;...

etwa ein Monat 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.

etwa ein Monat 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...

etwa ein Monat 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...

etwa ein Monat 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...

etwa ein Monat ago | 0

| accepted

Answered

How to use str2func with a function handle in the string

From the documentation for str2func, "Workspace variables are not available to the str2func function." See this answer. You ...

How to use str2func with a function handle in the string

From the documentation for str2func, "Workspace variables are not available to the str2func function." See this answer. You ...

etwa ein Monat ago | 0

| accepted

Answered

Finding rows/indices by comparing individual elements of rows of one matrix to another

For less than or equal to: find(all(m1 <= m2, 2)) For less than: find(all(m1 < m2, 2))

Finding rows/indices by comparing individual elements of rows of one matrix to another

For less than or equal to: find(all(m1 <= m2, 2)) For less than: find(all(m1 < m2, 2))

etwa ein Monat ago | 2

| accepted

Answered

How to skip lines to execute/run?

return % ? Or have your if block encompass the lines to be skipped and change the condition to the opposite of your condition f...

How to skip lines to execute/run?

return % ? Or have your if block encompass the lines to be skipped and change the condition to the opposite of your condition f...

etwa ein Monat ago | 0

Answered

How to design GUI buttons?

You can set the CData of a uicontrol pushbutton: p = uicontrol('Style', 'pushbutton', 'Position', [100, 150, 100, 30], 'String'...

How to design GUI buttons?

You can set the CData of a uicontrol pushbutton: p = uicontrol('Style', 'pushbutton', 'Position', [100, 150, 100, 30], 'String'...

etwa ein Monat ago | 1

| accepted

Answered

How to bold dialog box?

You can tell msgbox, inputdlg, warndlg, errordlg, and questdlg (and maybe others?) to use a tex interpreter. They all default to...

How to bold dialog box?

You can tell msgbox, inputdlg, warndlg, errordlg, and questdlg (and maybe others?) to use a tex interpreter. They all default to...

etwa ein Monat ago | 1

| accepted

Answered

How can I extract points (sum of values) from variable size groups of lines (separated from NaN values) in the same column ?

Potentially over-complicated but should work: cA = cumsum([A, B],'omitnan'); idx = [isnan(A(2:end)); 1] & ~isnan(A); C = diff...

How can I extract points (sum of values) from variable size groups of lines (separated from NaN values) in the same column ?

Potentially over-complicated but should work: cA = cumsum([A, B],'omitnan'); idx = [isnan(A(2:end)); 1] & ~isnan(A); C = diff...

etwa ein Monat ago | 1

Answered

How to split the data inside the matrix correctly?

Here's another uglier way. C = mat2cell(matrix, diff([0; find(diff(matrix(:,2))); size(matrix,1)]), 2);

How to split the data inside the matrix correctly?

Here's another uglier way. C = mat2cell(matrix, diff([0; find(diff(matrix(:,2))); size(matrix,1)]), 2);

etwa ein Monat ago | 0

| accepted

Answered

Using sign function in Matlab

sign(x) returns a matrix the same size as x. If the dimensions of x (and therefore sign(x)) are N-1 x 1 and the dimensions of D2...

Using sign function in Matlab

sign(x) returns a matrix the same size as x. If the dimensions of x (and therefore sign(x)) are N-1 x 1 and the dimensions of D2...

etwa ein Monat ago | 0

Answered

How to do correlation between each row of two matrices?

The default correlation coefficient which corr calculates is described here (the Pearson linear correlation coefficient): https...

How to do correlation between each row of two matrices?

The default correlation coefficient which corr calculates is described here (the Pearson linear correlation coefficient): https...

etwa ein Monat ago | 1

| accepted