Answered

Can the >> Be Amended In The Command Window

I don't know if it will still work, but you could try Yair Altman's <https://www.mathworks.com/matlabcentral/fileexchange/26471-...

Can the >> Be Amended In The Command Window

I don't know if it will still work, but you could try Yair Altman's <https://www.mathworks.com/matlabcentral/fileexchange/26471-...

23 hours ago | 0

| accepted

Answered

Processing array where the elements are sometimes min/sec and sometimes hour/min/sec

Oh, dear. I just found a terrible, wonderful obfuscated solution: digitArray = char(raceTime)-'0'; idx = digitArray(:,en...

Processing array where the elements are sometimes min/sec and sometimes hour/min/sec

Oh, dear. I just found a terrible, wonderful obfuscated solution: digitArray = char(raceTime)-'0'; idx = digitArray(:,en...

4 days ago | 0

Answered

Processing array where the elements are sometimes min/sec and sometimes hour/min/sec

Here is the idea I had, after posting this. The core idea is to create a "template" of zeros for the largest format needed (e.g....

Processing array where the elements are sometimes min/sec and sometimes hour/min/sec

Here is the idea I had, after posting this. The core idea is to create a "template" of zeros for the largest format needed (e.g....

5 days ago | 1

Question

Processing array where the elements are sometimes min/sec and sometimes hour/min/sec

I have some race data of the form raceTime = {'28:44','54:08','1:02:34','1:58:33'}; Because some times are less than an ...

6 days ago | 6 answers | 0

Answered

How can I load and save a excel data file (which has negative values in some rows) in MATLAB as an executable double. I tried and it gives me NAN for negative values. Here is the file. Thanks.

The problem is that in the Excel file, those are not negative signs in those numbers -- they are dashes or some other character....

How can I load and save a excel data file (which has negative values in some rows) in MATLAB as an executable double. I tried and it gives me NAN for negative values. Here is the file. Thanks.

The problem is that in the Excel file, those are not negative signs in those numbers -- they are dashes or some other character....

6 days ago | 0

| accepted

Answered

How to assign next matching string

If _c_ is your input array, then for nc = size(c,1)-1:-1:1; if not(ismember(lower(c{nc,5}),{'same','diff'})) ...

How to assign next matching string

If _c_ is your input array, then for nc = size(c,1)-1:-1:1; if not(ismember(lower(c{nc,5}),{'same','diff'})) ...

8 days ago | 1

| accepted

Answered

How can I make this type of array.

Pending an answer to the question in my comment, here is my best current guess as to what you want: output = [yk, [0; yk(1:...

How can I make this type of array.

Pending an answer to the question in my comment, here is my best current guess as to what you want: output = [yk, [0; yk(1:...

8 days ago | 0

Answered

I don't understand how this code results in an infinite loop. I believe it is a rounding error but changing the code has not worked.

It's because this approximation of pi: exact = 3.14159; is _not_ exact. In reality, it is further off from pi than your ...

I don't understand how this code results in an infinite loop. I believe it is a rounding error but changing the code has not worked.

It's because this approximation of pi: exact = 3.14159; is _not_ exact. In reality, it is further off from pi than your ...

10 days ago | 0

Answered

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

The specific reason you get that error is that _fzero_ attempts to call your function _trapecio_ with an argument value of about...

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

The specific reason you get that error is that _fzero_ attempts to call your function _trapecio_ with an argument value of about...

10 days ago | 1

Answered

Separating Matrix by Column By Pattern?

This will do what you want assuming that the data start on Sunday. NDAYS = 300; HOURS_PER_DAY = 24; DAYS_PER_WEEK...

Separating Matrix by Column By Pattern?

This will do what you want assuming that the data start on Sunday. NDAYS = 300; HOURS_PER_DAY = 24; DAYS_PER_WEEK...

11 days ago | 0

Answered

a problem while using an anonymous function

Replace poiss_pdf=@(x) (1/factorial(x))*(lamda^x)*exp(-lamda); with poiss_pdf=@(x) (1./gamma(x+1)).*(lamda.^x).*exp...

a problem while using an anonymous function

Replace poiss_pdf=@(x) (1/factorial(x))*(lamda^x)*exp(-lamda); with poiss_pdf=@(x) (1./gamma(x+1)).*(lamda.^x).*exp...

11 days ago | 0

| accepted

Answered

why am i getting the error: Index in p

Calling your function like this worked for me: f = @(t,y)(-3*y/t)+9*t.^2; tinit=-.5; yinit= 3.15; h= .2; n=10; ...

why am i getting the error: Index in p

Calling your function like this worked for me: f = @(t,y)(-3*y/t)+9*t.^2; tinit=-.5; yinit= 3.15; h= .2; n=10; ...

11 days ago | 0

Answered

Splitting a matrix to fit fitgmdist

If I understand correctly, then GMMobject = fitgmdist(a(:),1) does what you want. In general, you might also be inter...

Splitting a matrix to fit fitgmdist

If I understand correctly, then GMMobject = fitgmdist(a(:),1) does what you want. In general, you might also be inter...

11 days ago | 2

| accepted

Answered

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

I can't be sure, but it looks like you've inadvertently defined Nin to just be a scalar: Nin(1,:)=100000 Nin = ...

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

I can't be sure, but it looks like you've inadvertently defined Nin to just be a scalar: Nin(1,:)=100000 Nin = ...

16 days ago | 0

Answered

Where in documentation does it say that fitnet([]) gives a linear model?

In the Input Arguments section of the documentation, where it discusses the _hiddenSizes_ input, there is the sentence, "The len...

Where in documentation does it say that fitnet([]) gives a linear model?

In the Input Arguments section of the documentation, where it discusses the _hiddenSizes_ input, there is the sentence, "The len...

17 days ago | 2

Answered

Concatenate multiple sessions in ttest2 to return a 20x1 matrix

It seems to me that the variables that comprise _difftot_ (e.g. _prewtr_) are all scalars, so _difftot_ is a scalar value that i...

Concatenate multiple sessions in ttest2 to return a 20x1 matrix

It seems to me that the variables that comprise _difftot_ (e.g. _prewtr_) are all scalars, so _difftot_ is a scalar value that i...

18 days ago | 1

| accepted

Answered

Same problem, same Matlab, different answers

Hazy memories here, but I think even the same processor can have a different <https://en.wikipedia.org/wiki/Basic_Linear_Algebra...

Same problem, same Matlab, different answers

Hazy memories here, but I think even the same processor can have a different <https://en.wikipedia.org/wiki/Basic_Linear_Algebra...

18 days ago | 0

Answered

how to exclude a row from a matrix

Assuming that what you want is to exclude any row with a NaN in any position, then either T = T(all(~isnan(T),2),:); or ...

how to exclude a row from a matrix

Assuming that what you want is to exclude any row with a NaN in any position, then either T = T(all(~isnan(T),2),:); or ...

18 days ago | 0

| accepted

Answered

Issue with && in matrix operation.

I suggest that you carefully read the <https://www.mathworks.com/help/matlab/ref/logicaloperatorsshortcircuit.html documentation...

Issue with && in matrix operation.

I suggest that you carefully read the <https://www.mathworks.com/help/matlab/ref/logicaloperatorsshortcircuit.html documentation...

20 days ago | 0

Answered

how to split a member of cell array

Another version of the loop, that is a little bit more intuitive to me: OutCell = cell(500, 1); for nc = 1:100 fo...

how to split a member of cell array

Another version of the loop, that is a little bit more intuitive to me: OutCell = cell(500, 1); for nc = 1:100 fo...

20 days ago | 0

Answered

Matrix Manipulation Average of specific column

If _A_ is the array with your values, then A10 = (A > 10); meanA = sum(A.*A10)./sum(A10)

Matrix Manipulation Average of specific column

If _A_ is the array with your values, then A10 = (A > 10); meanA = sum(A.*A10)./sum(A10)

25 days ago | 0

Answered

plot pdf curve for range y -50 to 50

Try y=-50:50; py=3/4*(abs(y).*exp(-sqrt(3).*abs(y)).*(abs(y-3).*exp(-sqrt(3)*abs(y-3)))); plot(y,py); I did a few ...

plot pdf curve for range y -50 to 50

Try y=-50:50; py=3/4*(abs(y).*exp(-sqrt(3).*abs(y)).*(abs(y-3).*exp(-sqrt(3)*abs(y-3)))); plot(y,py); I did a few ...

25 days ago | 0

Answered

Bar plot with error bar

See my answer <https://www.mathworks.com/matlabcentral/answers/85885-bar-with-errorbars-on-the-same-figure#answer_95394 here>.

Bar plot with error bar

See my answer <https://www.mathworks.com/matlabcentral/answers/85885-bar-with-errorbars-on-the-same-figure#answer_95394 here>.

25 days ago | 0

Answered

How to find three largest absolute value correlations in a table

Use the <https://www.mathworks.com/help/matlab/ref/maxk.html |*maxk*|> function. maxk(abs(p07),3)

How to find three largest absolute value correlations in a table

Use the <https://www.mathworks.com/help/matlab/ref/maxk.html |*maxk*|> function. maxk(abs(p07),3)

25 days ago | 0

| accepted

Answered

How to find three largest absolute value correlations in a table

sort(abs(p07(:))) and take the first three values of that array.

How to find three largest absolute value correlations in a table

sort(abs(p07(:))) and take the first three values of that array.

25 days ago | 0

Answered

0x1 matrix getting while using find function

My best guess here, with the limited information you have given, is that you are trying to compare a number to one that is not _...

0x1 matrix getting while using find function

My best guess here, with the limited information you have given, is that you are trying to compare a number to one that is not _...

1 month ago | 1

Answered

How create a decreasing axis for a histogram plot?

The axis direction is a property of the figures axes themselves, not an input to the histogram command. x = randn(1000,1); ...

How create a decreasing axis for a histogram plot?

The axis direction is a property of the figures axes themselves, not an input to the histogram command. x = randn(1000,1); ...

1 month ago | 0

Answered

Alternative to while loops without using loop?

Here is a way to do this without a while loop. It uses the trick I mentioned in a comment, that there are a finite number (512) ...

Alternative to while loops without using loop?

Here is a way to do this without a while loop. It uses the trick I mentioned in a comment, that there are a finite number (512) ...

2 months ago | 0

Answered

How do I do calculations with the last and first array member in a for loop?

test = [1 2 3]; N = numel(test); idx = [1:N; [2:N,1]]; consecutiveSum = sum(test(idx));

How do I do calculations with the last and first array member in a for loop?

test = [1 2 3]; N = numel(test); idx = [1:N; [2:N,1]]; consecutiveSum = sum(test(idx));

2 months ago | 0

Answered

Sampling a random normal to create a vector of truncated normals

Less elegant than |*truncate*|, but can be used in core MATLAB ... % Desired number of samples N = 1000; % Draw s...

Sampling a random normal to create a vector of truncated normals

Less elegant than |*truncate*|, but can be used in core MATLAB ... % Desired number of samples N = 1000; % Draw s...

2 months ago | 0

| accepted