5.343 total contributions since 2014

Suspensa Vix Via Fit

Answered

Change colour order and restore it

"I want to change figure colour order" Figures do not have a ColorOrder propery, only axes do. It is easy to change the axes' ...

Change colour order and restore it

"I want to change figure colour order" Figures do not have a ColorOrder propery, only axes do. It is easy to change the axes' ...

ongeveer een uur ago | 0

Answered

How Can I count the ascending runs in array ?

As KSSV wrote, you might find diff useful: >> y = y([1,1:end]) y = 1 1 1 0 0 1 1 1

How Can I count the ascending runs in array ?

As KSSV wrote, you might find diff useful: >> y = y([1,1:end]) y = 1 1 1 0 0 1 1 1

ongeveer 7 uur ago | 0

Answered

Vectorized Search of substrings in Cell Array

>> t = {'abcde','bcde','abc','ac'}; >> ~cellfun(@isempty,strfind(t,'bc')) ans = 1 1 1 0

Vectorized Search of substrings in Cell Array

>> t = {'abcde','bcde','abc','ac'}; >> ~cellfun(@isempty,strfind(t,'bc')) ans = 1 1 1 0

ongeveer 7 uur ago | 0

Answered

To get the column number of max and min number

>> a = [1,5,3,7,4] a = 1 5 3 7 4 >> [~,mxi] = max(a) mxi = 4 >> [~,mni] = min(a) mni = 1

To get the column number of max and min number

>> a = [1,5,3,7,4] a = 1 5 3 7 4 >> [~,mxi] = max(a) mxi = 4 >> [~,mni] = min(a) mni = 1

ongeveer 22 uur ago | 1

| accepted

Answered

Little Bit Help Required Regarding Loop

"I just want to save all the values means every time when loop run it keep save the last results and save the new results in the...

Little Bit Help Required Regarding Loop

"I just want to save all the values means every time when loop run it keep save the last results and save the new results in the...

1 dag ago | 1

| accepted

Answered

Get one element from each row but not the same column

All six permutations of sums selecting one value from each row: >> N = 3; >> A = randi(9,N,N) A = 8 4 8 9 6 7...

Get one element from each row but not the same column

All six permutations of sums selecting one value from each row: >> N = 3; >> A = randi(9,N,N) A = 8 4 8 9 6 7...

1 dag ago | 1

Answered

what does the L-shaped bracket mean?

Those brackets are actually the common way in mathematics to represent the floor function: https://www.mathsisfun.com/sets/func...

what does the L-shaped bracket mean?

Those brackets are actually the common way in mathematics to represent the floor function: https://www.mathsisfun.com/sets/func...

2 dagen ago | 2

Answered

Matrix element changing with loop

5 is a scalar. A scalar has size 1x1. On the second loop iteration a has size Nx2 (we don't know the actual size because you di...

Matrix element changing with loop

5 is a scalar. A scalar has size 1x1. On the second loop iteration a has size Nx2 (we don't know the actual size because you di...

2 dagen ago | 0

Answered

how do you check that a value input into your code is exactly 7 digits long before proceeding?

idNumber = '1234567'; assert(numel(idNumber)==7,'Wrong length ID number')

how do you check that a value input into your code is exactly 7 digits long before proceeding?

idNumber = '1234567'; assert(numel(idNumber)==7,'Wrong length ID number')

3 dagen ago | 0

Answered

How can I generate an array of binary data of this form?

It might not be the most beautiful algorithm in the world, but this works (on 64 bit MATLAB) for even N values up to at least N...

How can I generate an array of binary data of this form?

It might not be the most beautiful algorithm in the world, but this works (on 64 bit MATLAB) for even N values up to at least N...

3 dagen ago | 0

Answered

Conditional function creating with @ handle

Directly for this specific calculation: >> f = @(x,y) x + y*(1-2*((x*y)<=1)); >> f(1,2) ans = 3 >> f(2,1) ans = 3 It wor...

Conditional function creating with @ handle

Directly for this specific calculation: >> f = @(x,y) x + y*(1-2*((x*y)<=1)); >> f(1,2) ans = 3 >> f(2,1) ans = 3 It wor...

3 dagen ago | 1

| accepted

Answered

Passing data through fminsearch

You should definitely avoid global variables. For your situation the easiest way to parameterize a function is to use a simple ...

Passing data through fminsearch

You should definitely avoid global variables. For your situation the easiest way to parameterize a function is to use a simple ...

4 dagen ago | 0

Answered

Any suggestion on how to solve this problem using Matlab?

I know this is homework, but someone needs to show that it is a waste time writing loops, it is much better to write simple vect...

Any suggestion on how to solve this problem using Matlab?

I know this is homework, but someone needs to show that it is a waste time writing loops, it is much better to write simple vect...

4 dagen ago | 0

Answered

Duplicate every element of a matrix to NxN elements

>> M = [1,2;3,4]; >> kron(M,[1,1;1,1]) ans = 1 1 2 2 1 1 2 2 3 3 4 4 3 3 4 4

Duplicate every element of a matrix to NxN elements

>> M = [1,2;3,4]; >> kron(M,[1,1;1,1]) ans = 1 1 2 2 1 1 2 2 3 3 4 4 3 3 4 4

4 dagen ago | 0

| accepted

Answered

accumarray does not return the correct sum

Your data: hdr = {'Date','ID','x','y','z','Profit'}; arr = {... '01-Jan-2019' 157350 0 1 100 0.470000000000000 '01-Jan-2019'...

accumarray does not return the correct sum

Your data: hdr = {'Date','ID','x','y','z','Profit'}; arr = {... '01-Jan-2019' 157350 0 1 100 0.470000000000000 '01-Jan-2019'...

5 dagen ago | 1

Answered

Strange behavior of the editor in the forum

Unfortunately the new editor does not work with Windows high-contrast mode, most of the toolbar buttons end up totally blank: ...

Strange behavior of the editor in the forum

Unfortunately the new editor does not work with Windows high-contrast mode, most of the toolbar buttons end up totally blank: ...

5 dagen ago | 0

Answered

Experts of MATLAB, how did you learn? Any advice for beginner/intermediate users?

I reject the label "expert", but here is my two cents worth anyway: MATLAB Specific: MATLAB has a great feature that very few ...

Experts of MATLAB, how did you learn? Any advice for beginner/intermediate users?

I reject the label "expert", but here is my two cents worth anyway: MATLAB Specific: MATLAB has a great feature that very few ...

5 dagen ago | 50

| accepted

Answered

where (what package) is the Matlab's wvd function?

Signal Processing Toolbox. You can easily find this out yourself using the online help, simply finding that page using your fav...

where (what package) is the Matlab's wvd function?

Signal Processing Toolbox. You can easily find this out yourself using the online help, simply finding that page using your fav...

6 dagen ago | 0

Answered

Using cellfun() to set cell array of graphic objects 'Visible' Property to 'off'

You will need to define an anonymous function like this: cellfun(@(g)set(g,'Visible','off'),your_cell_array_of_handles) Note t...

Using cellfun() to set cell array of graphic objects 'Visible' Property to 'off'

You will need to define an anonymous function like this: cellfun(@(g)set(g,'Visible','off'),your_cell_array_of_handles) Note t...

6 dagen ago | 2

| accepted

Answered

Create function handle with several variables/arguments

Why not just vectorize the multiplication and summation?: fun = @(z) sum(cv(:).*z(:)); https://www.mathworks.com/help/matlab/m...

Create function handle with several variables/arguments

Why not just vectorize the multiplication and summation?: fun = @(z) sum(cv(:).*z(:)); https://www.mathworks.com/help/matlab/m...

6 dagen ago | 2

| accepted

Answered

How to concentrate matrix 100 times?

Your approach is entirely in the wrong direction: using numbered variables is a sign that you are doing something wrong with you...

How to concentrate matrix 100 times?

Your approach is entirely in the wrong direction: using numbered variables is a sign that you are doing something wrong with you...

7 dagen ago | 0

| accepted

Answered

How to use the prctile (X,p,'all') function?

According to the MATLAB documentation the 'all' option was added in version R2018b: https://www.mathworks.com/help/stats/releas...

How to use the prctile (X,p,'all') function?

According to the MATLAB documentation the 'all' option was added in version R2018b: https://www.mathworks.com/help/stats/releas...

7 dagen ago | 1

| accepted

Answered

Using the matlab to achieve the a(k)+a(j) when k is not equal to j in every stage

a = [1,2,3,4]; for k = 1:4 b = 0; for j = 1:4 if j~=k b = b + a(k) + a(j); en...

Using the matlab to achieve the a(k)+a(j) when k is not equal to j in every stage

a = [1,2,3,4]; for k = 1:4 b = 0; for j = 1:4 if j~=k b = b + a(k) + a(j); en...

7 dagen ago | 0

| accepted

Answered

Sum columns of matrix

>> M = [1,5,2,4,3,2;2,3,1,4,4,1;4,5,2,2,3,1] M = 1 5 2 4 3 2 2 3 1 4 4 1 4 5 2 2 3 1 ...

Sum columns of matrix

>> M = [1,5,2,4,3,2;2,3,1,4,4,1;4,5,2,2,3,1] M = 1 5 2 4 3 2 2 3 1 4 4 1 4 5 2 2 3 1 ...

8 dagen ago | 0

| accepted

Answered

How to split a [30x250x1000] array into 1,000-2D matrices

Just use a simple cell array: function epoch = matrix_extractor(data_class,number_epochs) data_class; C = cell(1,numb...

How to split a [30x250x1000] array into 1,000-2D matrices

Just use a simple cell array: function epoch = matrix_extractor(data_class,number_epochs) data_class; C = cell(1,numb...

8 dagen ago | 1

| accepted

Answered

Too many input arguments

Everywhere you call function HionpH you call it with two input arguments, but you defined the actual function with just one inpu...

Too many input arguments

Everywhere you call function HionpH you call it with two input arguments, but you defined the actual function with just one inpu...

8 dagen ago | 1

| accepted

Answered

Using fprintf to create a table of values

Remember that MATLAB is column-major, so it works down the columns first. Pay careful attention to the orientation of the vector...

Using fprintf to create a table of values

Remember that MATLAB is column-major, so it works down the columns first. Pay careful attention to the orientation of the vector...

9 dagen ago | 0

Answered

How to vectorize double sum

>> N = 4; >> x = randi(9,3,N) x = 5 4 8 9 2 9 9 8 1 1 4 1 >> F = @(c)bsxfun(@minus,x(:,c),x(:,c...

How to vectorize double sum

>> N = 4; >> x = randi(9,3,N) x = 5 4 8 9 2 9 9 8 1 1 4 1 >> F = @(c)bsxfun(@minus,x(:,c),x(:,c...

9 dagen ago | 1

| accepted

Answered

Increment dates using for loop

>> D = datetime('01-Jan-2018'); >> N = 14; >> G = 3; >> V = D + caldays(0:ceil(N/G)-1).'; >> V = repelem(V,G); >> V = V(1:N...

Increment dates using for loop

>> D = datetime('01-Jan-2018'); >> N = 14; >> G = 3; >> V = D + caldays(0:ceil(N/G)-1).'; >> V = repelem(V,G); >> V = V(1:N...

9 dagen ago | 0