Answered

Insert values of one vector at specific places into another

a = [0 0 0 0 1 0 0 0 1 0 1 0 0 0 1 0 0 1 0]; b = [ 10 20 30 40 50 ]; c = zeros(size(a)); c(logical(a)) = b

Insert values of one vector at specific places into another

a = [0 0 0 0 1 0 0 0 1 0 1 0 0 0 1 0 0 1 0]; b = [ 10 20 30 40 50 ]; c = zeros(size(a)); c(logical(a)) = b

ungefär 3 år ago | 0

| accepted

Answered

access data returned from a method of a class in other methods

You could make it a private property, the private property can only be accessed by the class (see property attributes). You're p...

access data returned from a method of a class in other methods

You could make it a private property, the private property can only be accessed by the class (see property attributes). You're p...

ungefär 3 år ago | 0

| accepted

Answered

How can I find the Y value on an X–Y plot that corresponds to the tangent of the flattest part of a curve?

How robust this is depends on the consistency of that initial pattern, i.e. the initial acceleration followed by a period of dec...

How can I find the Y value on an X–Y plot that corresponds to the tangent of the flattest part of a curve?

How robust this is depends on the consistency of that initial pattern, i.e. the initial acceleration followed by a period of dec...

ungefär 3 år ago | 1

Answered

How to locate the x and y co-ordinate of minimum value from a contour plot automatically ?

Try: [min_e,index] = min(e,[],'all','linear'); x_min = x(index); y_min = y(index); hold on, plot(x_min,y_min,'ok','MarkerF...

How to locate the x and y co-ordinate of minimum value from a contour plot automatically ?

Try: [min_e,index] = min(e,[],'all','linear'); x_min = x(index); y_min = y(index); hold on, plot(x_min,y_min,'ok','MarkerF...

ungefär 3 år ago | 1

| accepted

Answered

Set properties from Superclass in subclass

Set the Access attribute in the superclass: classdef food properties protein carbs end ...

Set properties from Superclass in subclass

Set the Access attribute in the superclass: classdef food properties protein carbs end ...

ungefär 3 år ago | 0

| accepted

Answered

Repeat a 2D matrix at multiple places in 5D matrix

You could do the following: A(:, :, 2, :, :) = repmat(B,1,1,1,2,2);

Repeat a 2D matrix at multiple places in 5D matrix

You could do the following: A(:, :, 2, :, :) = repmat(B,1,1,1,2,2);

ungefär 3 år ago | 0

| accepted

Answered

Unable to perform assignment because the left and right sides have a different number of elements.

Your vlookup is not returning a value when j = 634. You will need a condition to deal with this when it happens. For example...

Unable to perform assignment because the left and right sides have a different number of elements.

Your vlookup is not returning a value when j = 634. You will need a condition to deal with this when it happens. For example...

ungefär 3 år ago | 0

| accepted

Answered

How to revert Editor window in MATLAB 2021A back to normal?

How to revert Editor window in MATLAB 2021A back to normal?

ungefär 3 år ago | 0

| accepted

Answered

add data information with scatter or plot

Personally, I would just use scatter3 and then look at the data from above (along the z-axis). So something like: scatter3(x,y,...

add data information with scatter or plot

Personally, I would just use scatter3 and then look at the data from above (along the z-axis). So something like: scatter3(x,y,...

ungefär 3 år ago | 0

| accepted

Answered

Interchange dimensions of cell array and the matrices included in it

Here's one way temp = vertcat(originalData{:}); D = repmat({zeros(3,27)},1,1000); % preallocate for ii = 1:1000 D{ii} = ...

Interchange dimensions of cell array and the matrices included in it

Here's one way temp = vertcat(originalData{:}); D = repmat({zeros(3,27)},1,1000); % preallocate for ii = 1:1000 D{ii} = ...

ungefär 3 år ago | 0

Answered

rectangle invisible in matlab

The following works for me: roi.Visible = 'off';

rectangle invisible in matlab

The following works for me: roi.Visible = 'off';

ungefär 3 år ago | 1

| accepted

Answered

How to extract points from a 3D plot that fall within a particular distance from the center coordinate?

The points which are within a radius, r, from the origin can be obtained as follows: index = sum(X.^2,2) < r^2; % X is an n by...

How to extract points from a 3D plot that fall within a particular distance from the center coordinate?

The points which are within a radius, r, from the origin can be obtained as follows: index = sum(X.^2,2) < r^2; % X is an n by...

ungefär 3 år ago | 1

Answered

connect Matlab to Binance API

Try my recent submission to the file exchange: MATLAB-Binance-API Then placing a limit order is simply: obj = spot.newOrder(...

connect Matlab to Binance API

Try my recent submission to the file exchange: MATLAB-Binance-API Then placing a limit order is simply: obj = spot.newOrder(...

mer än 3 år ago | 2

Answered

Finding coordinates with image processing

You could use the regionprops function to get the centroids. See the following example: % This just sets up an image for demo ...

Finding coordinates with image processing

You could use the regionprops function to get the centroids. See the following example: % This just sets up an image for demo ...

mer än 3 år ago | 0

Answered

Extracting files of the same name only from the first level of subdirectories

Hey Bob, a single star will go down one level only, so try the following: list = dir(fullfile(Alevel,'*','filename.txt'))

Extracting files of the same name only from the first level of subdirectories

Hey Bob, a single star will go down one level only, so try the following: list = dir(fullfile(Alevel,'*','filename.txt'))

mer än 3 år ago | 0

| accepted

Answered

switch command on listbox value

You can get an index of the selected values as follows: idx = ismember(app.ListBox.Items,app.ListBox.Value); Then, make the pl...

switch command on listbox value

You can get an index of the selected values as follows: idx = ismember(app.ListBox.Items,app.ListBox.Value); Then, make the pl...

mer än 3 år ago | 0

| accepted

Answered

Reading values from xml file

You can now read XML files in R2021a using readtable (and readtimetable). For example: filename = 'students.xml'; T = readtabl...

Reading values from xml file

You can now read XML files in R2021a using readtable (and readtimetable). For example: filename = 'students.xml'; T = readtabl...

mer än 3 år ago | 3

Answered

How can I assign information to my array file?

You could make a table as follows: w = strings(size(mci)); w(mci<0.4) = "wheeze"; w(mci>=0.4) = "non-wheeze"; T = table(mci....

How can I assign information to my array file?

You could make a table as follows: w = strings(size(mci)); w(mci<0.4) = "wheeze"; w(mci>=0.4) = "non-wheeze"; T = table(mci....

mer än 3 år ago | 0

| accepted

Answered

Capture plot titles using getframe and writerobj

You can use the figure handle (instead of the axis handle) with the getframe function and that captures the entire interior of t...

Capture plot titles using getframe and writerobj

You can use the figure handle (instead of the axis handle) with the getframe function and that captures the entire interior of t...

mer än 3 år ago | 0

| accepted

Answered

How to divide images from folder into 4x4 blocks

Hi Petrus, the mat2cell approach that Jonas pointed out can be done more generally as follows. Note, this handles the scenario w...

How to divide images from folder into 4x4 blocks

Hi Petrus, the mat2cell approach that Jonas pointed out can be done more generally as follows. Note, this handles the scenario w...

mer än 3 år ago | 0

| accepted

Answered

Identify index of cell based on stringlength

Example data: Tstr{1}{1,1} = 'Hello... It me, I was wondering if after all these years youd like to meet'; Tstr{1}{2,1} = '18...

Identify index of cell based on stringlength

Example data: Tstr{1}{1,1} = 'Hello... It me, I was wondering if after all these years youd like to meet'; Tstr{1}{2,1} = '18...

mer än 3 år ago | 0

| accepted

Answered

bitget working with an example

As I'm sure you know, computers communicate at the lowest level with underlying switch-like states known as bits, whose digital ...

bitget working with an example

As I'm sure you know, computers communicate at the lowest level with underlying switch-like states known as bits, whose digital ...

mer än 3 år ago | 2

Answered

Getting error while deleting every row of the matrix M that contains the variable x

No need for any loops. Here's an example of data to work with M = randi(10,[10 3]); % sample data x = 3; % ...

Getting error while deleting every row of the matrix M that contains the variable x

No need for any loops. Here's an example of data to work with M = randi(10,[10 3]); % sample data x = 3; % ...

mer än 3 år ago | 1

Answered

Plotting doubles against cells

Here's an example, i've used X and Y in place of AAG and AAI to simplify: % example data X = arrayfun(@(x) cell(1,randi(1000,1...

Plotting doubles against cells

Here's an example, i've used X and Y in place of AAG and AAI to simplify: % example data X = arrayfun(@(x) cell(1,randi(1000,1...

mer än 3 år ago | 0

| accepted

Answered

Saving Output in a While Loop

You could store the letters as follows in the variable currentResult. I've added in some conditions to count lives. One could al...

Saving Output in a While Loop

You could store the letters as follows in the variable currentResult. I've added in some conditions to count lives. One could al...

mer än 3 år ago | 1

Answered

Increase matrix size, with the first matrix a the center of the new matrix

There is a function made specifically for this called padarray, try the following example: A = rand(2000); B = padarray(A,[100...

Increase matrix size, with the first matrix a the center of the new matrix

There is a function made specifically for this called padarray, try the following example: A = rand(2000); B = padarray(A,[100...

ungefär 4 år ago | 0

Answered

Rescale points plotted using scatter3 based on their distance from the origin

Yes. Firstly get distances from the origin: d = sqrt(sum(A.^2,2)); If you have the machine learning & statistics toolbox, you...

Rescale points plotted using scatter3 based on their distance from the origin

Yes. Firstly get distances from the origin: d = sqrt(sum(A.^2,2)); If you have the machine learning & statistics toolbox, you...

ungefär 4 år ago | 0

| accepted

Answered

Extracting specific rows with different content from a large table array

Tnew = T(T.MatDate>=SpecificDay-30 & T.MatDate<=SpecificDay+10,:);

Extracting specific rows with different content from a large table array

Tnew = T(T.MatDate>=SpecificDay-30 & T.MatDate<=SpecificDay+10,:);

ungefär 4 år ago | 1

Answered

How to pick the values from individual grids ?

The objective is to create an excel sheet with columns of data having different length. You can store data that has different le...

How to pick the values from individual grids ?

The objective is to create an excel sheet with columns of data having different length. You can store data that has different le...

ungefär 4 år ago | 1

| accepted

Answered

Sample a 3D surface

If I understand correctly, you just want to generate some x,y values that match your z values (i.e. b): [x,y] = meshgrid(1:size...

Sample a 3D surface

If I understand correctly, you just want to generate some x,y values that match your z values (i.e. b): [x,y] = meshgrid(1:size...

ungefär 4 år ago | 1

| accepted