Answered

I am not getting the correct answer when using datetime function

>> datetime(43100,'ConvertFrom','excel') ans = datetime 31-Dec-2017 00:00:00 >> You tried converting from (yr,mo,day...

I am not getting the correct answer when using datetime function

>> datetime(43100,'ConvertFrom','excel') ans = datetime 31-Dec-2017 00:00:00 >> You tried converting from (yr,mo,day...

5 hours ago | 1

| accepted

Answered

How do I determine which model fits my data the best?

I'd start by returning the second, optional gof (goodness of fit) output variable that contains Field Valu...

How do I determine which model fits my data the best?

I'd start by returning the second, optional gof (goodness of fit) output variable that contains Field Valu...

1 day ago | 0

| accepted

Answered

How to display all decimal numbers for floating numbers?

I'll guess for homework Q? the answer is less esoteric than Walter's take... :) Yes, if you need more precision than the defaul...

How to display all decimal numbers for floating numbers?

I'll guess for homework Q? the answer is less esoteric than Walter's take... :) Yes, if you need more precision than the defaul...

2 days ago | 0

Answered

how can I loop a repmat function over columns of matrix?

Rereading, I guess it's just r=cell2mat(arrayfun(@(v,w) repelem(v,w,1),v,repmat(w,1,3),'uni',0)); for each array v. Naming v...

how can I loop a repmat function over columns of matrix?

Rereading, I guess it's just r=cell2mat(arrayfun(@(v,w) repelem(v,w,1),v,repmat(w,1,3),'uni',0)); for each array v. Naming v...

3 days ago | 0

Answered

How Do I Plotting in Time Domain?

>> format bank >> 10/22.59*17066 ans = 7554.67 >> 10 rev/22.59 rev/sec * 17066 samples/sec --> samples/10 rev...

How Do I Plotting in Time Domain?

>> format bank >> 10/22.59*17066 ans = 7554.67 >> 10 rev/22.59 rev/sec * 17066 samples/sec --> samples/10 rev...

4 days ago | 0

| accepted

Answered

Creating 2x2 matrix is slow

The attached profile specific lines constitute only 39% of the total so there's 61% elsewhere but the allocation issue using [] ...

Creating 2x2 matrix is slow

The attached profile specific lines constitute only 39% of the total so there's 61% elsewhere but the allocation issue using [] ...

5 days ago | 0

| accepted

Answered

How to sum the intervals in matlab

v=[1000;800]; err=[0.5;-1.7]; intvl=[0 1;-2 -1]; intvN=[3;1]; newv=v.*[1+mean(intvl,2)/100]; Above yields >> newv newv = ...

How to sum the intervals in matlab

v=[1000;800]; err=[0.5;-1.7]; intvl=[0 1;-2 -1]; intvN=[3;1]; newv=v.*[1+mean(intvl,2)/100]; Above yields >> newv newv = ...

6 days ago | 0

Answered

sum of timetables for each months

totalvehicles=retime([buses;cars],'monthly',@sum);

sum of timetables for each months

totalvehicles=retime([buses;cars],'monthly',@sum);

7 days ago | 1

Answered

Scatterplot with condition on another matrix

clr=[0 0 1; 0 0 0]; % blue, black RGB triplets c=clr((A>C)+1,:); % set which based on lookup scatter(A,B,[...

Scatterplot with condition on another matrix

clr=[0 0 1; 0 0 0]; % blue, black RGB triplets c=clr((A>C)+1,:); % set which based on lookup scatter(A,B,[...

7 days ago | 0

| accepted

Answered

whats wrong with this if block?

(different_salts_available==1||2||3||4||5) is bad syntax for if in MATLAB. It results in testing the result of the logical exp...

whats wrong with this if block?

(different_salts_available==1||2||3||4||5) is bad syntax for if in MATLAB. It results in testing the result of the logical exp...

9 days ago | 0

| accepted

Answered

How can we create two vectors have normally distributed random entries with zero mean?

>> uv=randn(1000,2); >> uv=uv/sqrt(sum(uv(:,1).*uv(:,2))); >> uv(:,1).'*uv(:,2) ans = 1.0000 >> mean(uv) ans = 0....

How can we create two vectors have normally distributed random entries with zero mean?

>> uv=randn(1000,2); >> uv=uv/sqrt(sum(uv(:,1).*uv(:,2))); >> uv(:,1).'*uv(:,2) ans = 1.0000 >> mean(uv) ans = 0....

10 days ago | 1

Answered

readtable not understood behaviour

You could make a textimportoptions object and use it with readtable but with the text file as text, I'd just scan it and then c...

readtable not understood behaviour

You could make a textimportoptions object and use it with readtable but with the text file as text, I'd just scan it and then c...

11 days ago | 0

| accepted

Answered

Generate random Bistochastic matrix with zero diagonals

function a=bistochastic(a,tol) % return bistochastic matrix from input nonnegative matrix if nargin<2, tol=0.001; end s1=sum(...

Generate random Bistochastic matrix with zero diagonals

function a=bistochastic(a,tol) % return bistochastic matrix from input nonnegative matrix if nargin<2, tol=0.001; end s1=sum(...

14 days ago | 3

| accepted

Answered

undefined function 'isnan' for input arguments of type 'table'

Presuming the variables in data are named y and X, then nans = isnan(data.y) | (sum(isnan(data.X), 2) > 0); You have to select...

undefined function 'isnan' for input arguments of type 'table'

Presuming the variables in data are named y and X, then nans = isnan(data.y) | (sum(isnan(data.X), 2) > 0); You have to select...

14 days ago | 0

Answered

How can I access results from loop, that are stored in structs within a cell?

first_obs = 100; last_obs = 110; Nobs=last_obs-first_obs+1; % number rows to compute coeff_i=zeros(Nobs,3); % preallo...

How can I access results from loop, that are stored in structs within a cell?

first_obs = 100; last_obs = 110; Nobs=last_obs-first_obs+1; % number rows to compute coeff_i=zeros(Nobs,3); % preallo...

16 days ago | 0

| accepted

Answered

Write cell array defined by a variable to a excel file

"a cell array that I get after processing data which needs to be written to a excel file. For some reason, fprintf is not workin...

Write cell array defined by a variable to a excel file

"a cell array that I get after processing data which needs to be written to a excel file. For some reason, fprintf is not workin...

16 days ago | 0

Answered

How to vectorize this for maximum efficiency?

>> histc(label_lin,unique(label_lin)) ans = 2 1 1 1 3 >>

How to vectorize this for maximum efficiency?

>> histc(label_lin,unique(label_lin)) ans = 2 1 1 1 3 >>

17 days ago | 0

Answered

Can not terminate execution with if/for loop

What's the point of needing to type anything else after the loop has completed its three iterations? At that point you've alrea...

Can not terminate execution with if/for loop

What's the point of needing to type anything else after the loop has completed its three iterations? At that point you've alrea...

17 days ago | 0

Answered

(mapping toolbox) Map axes xdata, ydata and zdata meaning?

The map is still an axes underneath the hood so the internal property names are the same. But, the property name is just a name...

(mapping toolbox) Map axes xdata, ydata and zdata meaning?

The map is still an axes underneath the hood so the internal property names are the same. But, the property name is just a name...

17 days ago | 0

Answered

Can not terminate execution with if/for loop

Your break statement is in a nested for loop that is inside the while construct. break only exits the loop construct in which i...

Can not terminate execution with if/for loop

Your break statement is in a nested for loop that is inside the while construct. break only exits the loop construct in which i...

18 days ago | 0

Answered

Read multiple .mat files in the file path in sequence

for i=1:10 filename = sprintf('D:\matlab\0_cm(%d).mat',i); % build specific file name myVars = {'Scanning'}; S = load...

Read multiple .mat files in the file path in sequence

for i=1:10 filename = sprintf('D:\matlab\0_cm(%d).mat',i); % build specific file name myVars = {'Scanning'}; S = load...

18 days ago | 0

Answered

Extracting certain lines from a text file containing both characters and numbers

Presuming records (including blank lines) are as above, fid=fopen('HB.txt'); data=cell2mat(textscan(fid,'%f%f','headerlines',...

Extracting certain lines from a text file containing both characters and numbers

Presuming records (including blank lines) are as above, fid=fopen('HB.txt'); data=cell2mat(textscan(fid,'%f%f','headerlines',...

19 days ago | 0

Answered

How do I split a sing column .txt file by line?

Again, I'd suggest there's no need to actually create multiple text files to do this...several options exist in MATLAB; the simp...

How do I split a sing column .txt file by line?

Again, I'd suggest there's no need to actually create multiple text files to do this...several options exist in MATLAB; the simp...

20 days ago | 0

| accepted

Answered

How to make heatmap y-axis based on column names, not column values

data = [0 280 1170 0; 62 0 0 0]; VariableNames = {'colA', 'colB', 'colC', 'colD'}; rowid= {'rowA', 'rowB'}; hHM=heatmap(rowid...

How to make heatmap y-axis based on column names, not column values

data = [0 280 1170 0; 62 0 0 0]; VariableNames = {'colA', 'colB', 'colC', 'colD'}; rowid= {'rowA', 'rowB'}; hHM=heatmap(rowid...

21 days ago | 0

| accepted

Answered

how to avoid scientific notation when dealing with large integers?

Well, in base MATLAB you can't have more than >> intmax('uint64') ans = uint64 18446744073709551615 >> which is only...

how to avoid scientific notation when dealing with large integers?

Well, in base MATLAB you can't have more than >> intmax('uint64') ans = uint64 18446744073709551615 >> which is only...

22 days ago | 1

Answered

Problem in plotting the string variable

Nobody seems to have stumbled onto the easy answer as of yet...leaving the variable as a string when it is clearly a categorical...

Problem in plotting the string variable

Nobody seems to have stumbled onto the easy answer as of yet...leaving the variable as a string when it is clearly a categorical...

22 days ago | 0

Answered

Getting values from a for loop when specific condition met

break is like drawing the "Go To Jail" card in Monopoly--you "go directly to jail, do not pass GO, do not collect $200". Here w...

Getting values from a for loop when specific condition met

break is like drawing the "Go To Jail" card in Monopoly--you "go directly to jail, do not pass GO, do not collect $200". Here w...

23 days ago | 0

| accepted

Answered

Controlled Random Generator based off of two columns

function x=trafficX(RP,LO) % returns random count of X within upper limit RP but evenly divisible factor with lower limit LO %...

Controlled Random Generator based off of two columns

function x=trafficX(RP,LO) % returns random count of X within upper limit RP but evenly divisible factor with lower limit LO %...

23 days ago | 0

Answered

How to sort a matrix's columns by using indexes

See doc sortrows Not clear which array it is you wish sorted but mayhaps can accomplish directly -- altho the auxiliary array ...

How to sort a matrix's columns by using indexes

See doc sortrows Not clear which array it is you wish sorted but mayhaps can accomplish directly -- altho the auxiliary array ...

23 days ago | 0

Answered

how to save all iteration output to plot graph later ?

In bending(i) = depl(1,:); you don't have but one index dimension on LHS in which you're trying to store a vector... Before the...

how to save all iteration output to plot graph later ?

In bending(i) = depl(1,:); you don't have but one index dimension on LHS in which you're trying to store a vector... Before the...

23 days ago | 0