Answered

create a variable and specify its column

The specifics will depend on what format the variable day is. Here, I assume it is a datetime. % Create the table day = dateti...

create a variable and specify its column

The specifics will depend on what format the variable day is. Here, I assume it is a datetime. % Create the table day = dateti...

alrededor de 1 mes ago | 1

| accepted

Answered

sort boxplot based on 25-75th percentiles

Yes, it is possible. The algorithm would be something like Find the percentiles on the data, using the prctile command, before ...

sort boxplot based on 25-75th percentiles

Yes, it is possible. The algorithm would be something like Find the percentiles on the data, using the prctile command, before ...

alrededor de 1 mes ago | 0

| accepted

Answered

Index in position 1 exceeds array bounds (must not exceed 26)

You haven't provided enough info to run your code, which would make debugging much easier. You also didn't tell us which line gi...

Index in position 1 exceeds array bounds (must not exceed 26)

You haven't provided enough info to run your code, which would make debugging much easier. You also didn't tell us which line gi...

alrededor de 1 mes ago | 0

Answered

trying to use logical matrix to get remove some elements from matrix instead of getting a same matrix im getting a column matrix

Assuming you want zeros in the other locations: a=[1,2,3;12,21,2;2,1,2] b=(a>1) c = zeros(size(a)); c(b)=a(b) c = ...

trying to use logical matrix to get remove some elements from matrix instead of getting a same matrix im getting a column matrix

Assuming you want zeros in the other locations: a=[1,2,3;12,21,2;2,1,2] b=(a>1) c = zeros(size(a)); c(b)=a(b) c = ...

alrededor de 1 mes ago | 1

Answered

How to check what part of an array isn't scalar?

Just to clarify, are you saying that you have a categorical array, you are trying to apply the unique command to that array, and...

How to check what part of an array isn't scalar?

Just to clarify, are you saying that you have a categorical array, you are trying to apply the unique command to that array, and...

alrededor de 1 mes ago | 0

Answered

My output did not display in command windows when using script

The syntax you used, fprintf(fid,...) is explicitly for writing to files. Use fprintf(...) % without "fid" argument to write...

My output did not display in command windows when using script

The syntax you used, fprintf(fid,...) is explicitly for writing to files. Use fprintf(...) % without "fid" argument to write...

alrededor de 1 mes ago | 1

Answered

(Array indices must be positive integers or logical values.) any help plz

The specific reason you get that error is that sx is complex number. sx is complex because s is complex. s is complex because ...

(Array indices must be positive integers or logical values.) any help plz

The specific reason you get that error is that sx is complex number. sx is complex because s is complex. s is complex because ...

alrededor de 1 mes ago | 1

| accepted

Answered

How to change the plot title and file name when saving it to a for loop

Part of the problem is that you are mixing character arrays and strings. The following works (after you set your own outputdir):...

How to change the plot title and file name when saving it to a for loop

Part of the problem is that you are mixing character arrays and strings. The following works (after you set your own outputdir):...

alrededor de 1 mes ago | 1

| accepted

Answered

For loop to calculate distance between a 5d dimensional data point and another matrix

The distance from the i-th point of T to the j-th centroid is sqrt(sum((T(:,i) - centroids(:,j)).^2)); % Check my formula here,...

For loop to calculate distance between a 5d dimensional data point and another matrix

The distance from the i-th point of T to the j-th centroid is sqrt(sum((T(:,i) - centroids(:,j)).^2)); % Check my formula here,...

alrededor de 2 meses ago | 0

Answered

I have a variable with a string that I would like to use as a filename, how do I input that string into a function rather than the variable name?

I think I see the problem. Did you notice that the output of the inputdlg command is a cell array? You need the contents of that...

I have a variable with a string that I would like to use as a filename, how do I input that string into a function rather than the variable name?

I think I see the problem. Did you notice that the output of the inputdlg command is a cell array? You need the contents of that...

alrededor de 2 meses ago | 0

| accepted

Answered

array and logicals; deleting columns

Here is one way. arr = [1 2 3; 4 5 6; 7 8 9]; logic = [false true false]; new = arr(:,not(logic))

array and logicals; deleting columns

Here is one way. arr = [1 2 3; 4 5 6; 7 8 9]; logic = [false true false]; new = arr(:,not(logic))

alrededor de 2 meses ago | 0

| accepted

Answered

Indexing problem. I want to insert a vector into another vector with a loop.

Here is one way. A = [5 4 3]; B = [1 -1 -1 1 0 0 0 0 0 0 0 0 0 0]; for nb = 0:numel(B)-4 output = [A circshift(B,nb)...

Indexing problem. I want to insert a vector into another vector with a loop.

Here is one way. A = [5 4 3]; B = [1 -1 -1 1 0 0 0 0 0 0 0 0 0 0]; for nb = 0:numel(B)-4 output = [A circshift(B,nb)...

alrededor de 2 meses ago | 0

Answered

how to specify y axis?

Try this: clear clc clf x=1:1:24 yyaxis right y =[0,0,0,0,0,2.879097736,22.91004173,45.42868867,58.31916249,64,65,66,65,6...

how to specify y axis?

Try this: clear clc clf x=1:1:24 yyaxis right y =[0,0,0,0,0,2.879097736,22.91004173,45.42868867,58.31916249,64,65,66,65,6...

alrededor de 2 meses ago | 0

| accepted

Answered

how to specify y axis?

set(gca,'YTick',[0 500 1000],'YTickLabel',[0 500 1000])

how to specify y axis?

set(gca,'YTick',[0 500 1000],'YTickLabel',[0 500 1000])

alrededor de 2 meses ago | 1

Answered

Error Using fprintf Invalid file identifier. Use fopen to generate a valid file identifier.

Is this good enough? I = rand(2); if ~isnan(I) I if abs(I)>2 fprintf("Violated Bell Inequality"); end else f...

Error Using fprintf Invalid file identifier. Use fopen to generate a valid file identifier.

Is this good enough? I = rand(2); if ~isnan(I) I if abs(I)>2 fprintf("Violated Bell Inequality"); end else f...

alrededor de 2 meses ago | 0

| accepted

Answered

Using a Variable between different functions

You can pass them out of the first function: function [coin, I, evAlice, evBob] = CHSH_(sigma_x,sigma_z) and into the second o...

Using a Variable between different functions

You can pass them out of the first function: function [coin, I, evAlice, evBob] = CHSH_(sigma_x,sigma_z) and into the second o...

alrededor de 2 meses ago | 0

| accepted

Answered

I have a variable with a string that I would like to use as a filename, how do I input that string into a function rather than the variable name?

I don't have dxf_open, but the following -- which is effectively the same as what you posted -- works for me: answer = 'test'; ...

I have a variable with a string that I would like to use as a filename, how do I input that string into a function rather than the variable name?

I don't have dxf_open, but the following -- which is effectively the same as what you posted -- works for me: answer = 'test'; ...

alrededor de 2 meses ago | 0

Answered

joining one column from a table to another while matching all other columns

(Your code won't produce the tables a and b.) I believe the outerjoin command does what you want: a = table({'k','l','m','b','...

joining one column from a table to another while matching all other columns

(Your code won't produce the tables a and b.) I believe the outerjoin command does what you want: a = table({'k','l','m','b','...

alrededor de 2 meses ago | 0

| accepted

Answered

Difference between rng('shuffle') and NO rng for estimating with MLE

If you start a fresh instance of MATLAB, and generate a sequence of pseudorandom numbers, it will always be the same sequence. (...

Difference between rng('shuffle') and NO rng for estimating with MLE

If you start a fresh instance of MATLAB, and generate a sequence of pseudorandom numbers, it will always be the same sequence. (...

alrededor de 2 meses ago | 1

| accepted

Answered

TAKING [X1 X2 …] and [Y1 Y2 …] and reshaping them into [Y1 X1 Y2 X2 …]

xy = reshape([y;x],1,[]);

TAKING [X1 X2 …] and [Y1 Y2 …] and reshaping them into [Y1 X1 Y2 X2 …]

xy = reshape([y;x],1,[]);

alrededor de 2 meses ago | 0

| accepted

Answered

about prime matlab problem

The reason is that if an element of vec is equal to 1, then for j=2:sqrt(n) is for j=2:1 so that for loop is never entered, ...

about prime matlab problem

The reason is that if an element of vec is equal to 1, then for j=2:sqrt(n) is for j=2:1 so that for loop is never entered, ...

alrededor de 2 meses ago | 2

| accepted

Answered

Replacing row in matrix with previous row depending on condition

Here is one way: while any(A(:)==-2) rowToReplace = find(any(A==-2,2)); A(rowToReplace,:) = A(rowToReplace-1,:); en...

Replacing row in matrix with previous row depending on condition

Here is one way: while any(A(:)==-2) rowToReplace = find(any(A==-2,2)); A(rowToReplace,:) = A(rowToReplace-1,:); en...

alrededor de 2 meses ago | 1

| accepted

Answered

How can i create a table?

Did you try looking through the documentation for tables?

How can i create a table?

Did you try looking through the documentation for tables?

alrededor de 2 meses ago | 0

Answered

Integration for only positive values

Can you just replace your PDF with max(0,PDF) and proceed?

Integration for only positive values

Can you just replace your PDF with max(0,PDF) and proceed?

alrededor de 2 meses ago | 0

Answered

Looping the extraction of a vector from a 3d array

B = reshape(A,[174688,29224]);

Looping the extraction of a vector from a 3d array

B = reshape(A,[174688,29224]);

alrededor de 2 meses ago | 1

| accepted

Answered

How can the generated complex numbers represented by j instead of i?

If z is your complex variable in MATLAB, save the real part real(z) and the imaginary part imag(z) separately, and re-constr...

How can the generated complex numbers represented by j instead of i?

If z is your complex variable in MATLAB, save the real part real(z) and the imaginary part imag(z) separately, and re-constr...

alrededor de 2 meses ago | 1

Answered

"eig" use which algorithm to find eigenvalues

The algorithm is dependent on the properties of the input(s). The algorithm section of the documentation for eig gives some inf...

"eig" use which algorithm to find eigenvalues

The algorithm is dependent on the properties of the input(s). The algorithm section of the documentation for eig gives some inf...

alrededor de 2 meses ago | 0

| accepted

Answered

how to find the max element in each column and row and replace it with 1. If conflicting elements occur, look for the next max element.

Blatantly stealing ideas from Ameer's and Rajil's solutions here. But I think there are some potential issues with those, specif...

how to find the max element in each column and row and replace it with 1. If conflicting elements occur, look for the next max element.

Blatantly stealing ideas from Ameer's and Rajil's solutions here. But I think there are some potential issues with those, specif...

alrededor de 2 meses ago | 1

Answered

How do I insert a placeholder in a plot where I don't have data?

You could use interpolation to identify where the "trend" would be at the missing data point, and plot the interpolated values a...

How do I insert a placeholder in a plot where I don't have data?

You could use interpolation to identify where the "trend" would be at the missing data point, and plot the interpolated values a...

alrededor de 2 meses ago | 0

Answered

Correlation coefficient in 3D

Your formulas for den1 and den2 are not symmetric. It looks like den2 does not correspond to the formula in the screenshot, and ...

Correlation coefficient in 3D

Your formulas for den1 and den2 are not symmetric. It looks like den2 does not correspond to the formula in the screenshot, and ...

alrededor de 2 meses ago | 0