Answered

What is the algorithm used by svd function?

In old versions Matlab has used the optimzed version of LAPACK:dgesvd http://www.netlib.org/lapack/explore-html/d1/d7e/group__d...

What is the algorithm used by svd function?

In old versions Matlab has used the optimzed version of LAPACK:dgesvd http://www.netlib.org/lapack/explore-html/d1/d7e/group__d...

9 días ago | 0

Answered

Removing the top rows of a csv file

Folder = 'D:\Your\Folder'; FileList = dir(fullfile(Folder, '*.csv')); for iFile = 1:numel(FileList) File = fullfile(Fo...

Removing the top rows of a csv file

Folder = 'D:\Your\Folder'; FileList = dir(fullfile(Folder, '*.csv')); for iFile = 1:numel(FileList) File = fullfile(Fo...

9 días ago | 0

| accepted

Answered

Load and store several .wav files within multiple subfolders

AudioArray = cell(1, numel(theFiles)); for k = 1 : numel(theFiles) % NUMEL is more direct than LENGTH baseFileName = th...

Load and store several .wav files within multiple subfolders

AudioArray = cell(1, numel(theFiles)); for k = 1 : numel(theFiles) % NUMEL is more direct than LENGTH baseFileName = th...

9 días ago | 0

Answered

How to add two cells with strings together?

The message tells you, that A and B have different number of elements. Then a concatenation cannot work. If both have the same s...

How to add two cells with strings together?

The message tells you, that A and B have different number of elements. Then a concatenation cannot work. If both have the same s...

9 días ago | 1

Answered

How to reduce distance between two point of this curve ?

The trivial solution would be to reduce the numer of points: % th = linspace(pi/2, -pi/2, 100); ==> th = linspace(pi/2, -pi/2...

How to reduce distance between two point of this curve ?

The trivial solution would be to reduce the numer of points: % th = linspace(pi/2, -pi/2, 100); ==> th = linspace(pi/2, -pi/2...

10 días ago | 0

| accepted

Answered

Degree to radians conversion

Import the Excelfile by readtable . The conversion from degree to radians is easy, but in most cases not needed, because all tr...

Degree to radians conversion

Import the Excelfile by readtable . The conversion from degree to radians is easy, but in most cases not needed, because all tr...

10 días ago | 0

Answered

Basic question about pointer in mex function

Q1. But I was wondering if z, y stores addresses not values how can we calculate like this z[i] = x * y[i]; ? This is a questio...

Basic question about pointer in mex function

Q1. But I was wondering if z, y stores addresses not values how can we calculate like this z[i] = x * y[i]; ? This is a questio...

11 días ago | 0

| accepted

Answered

Compare rows of a column vector

The screenshot show the contents of ex_vec. It does not matter how you have obtained it. All you want to know is how to find row...

Compare rows of a column vector

The screenshot show the contents of ex_vec. It does not matter how you have obtained it. All you want to know is how to find row...

11 días ago | 0

Answered

Make a for loop for the following code

Naming a variable "went_from_to_probAge27" hides important information in the name. There this information can be accessed by re...

Make a for loop for the following code

Naming a variable "went_from_to_probAge27" hides important information in the name. There this information can be accessed by re...

11 días ago | 0

| accepted

Answered

removing for loop by using 3d matrix

What is your purpose of vectorizing the code? The processing time is dominated by imagesc and pause here. I assume the loop are ...

removing for loop by using 3d matrix

What is your purpose of vectorizing the code? The processing time is dominated by imagesc and pause here. I assume the loop are ...

11 días ago | 0

Answered

Why do I get a different result of calculation in for loop than in command line

Your analysis is correct: it seems unlogical. For an experiences programmer this is a secure signal, that something happens, whi...

Why do I get a different result of calculation in for loop than in command line

Your analysis is correct: it seems unlogical. For an experiences programmer this is a secure signal, that something happens, whi...

11 días ago | 1

Answered

Massive matrix, tridiagonal, ones()

A = [2 13 0 0 0 0; 1 2 13 0 0 0; 0 1 2 13 0 0; 0 0 1 2 13 0; 0 0 0 1 2 13]; d1 = diag(A, 0) % [2 2 ...

Massive matrix, tridiagonal, ones()

A = [2 13 0 0 0 0; 1 2 13 0 0 0; 0 1 2 13 0 0; 0 0 1 2 13 0; 0 0 0 1 2 13]; d1 = diag(A, 0) % [2 2 ...

12 días ago | 1

Answered

Problem with multiple inputs

for i=1:nargin nargin is the number of all inputs. For Untitled(a,varargin) thenumber of inputs is 1 larger than the size o...

Problem with multiple inputs

for i=1:nargin nargin is the number of all inputs. For Untitled(a,varargin) thenumber of inputs is 1 larger than the size o...

12 días ago | 1

| accepted

Answered

How to get random samples with certain distance between them?

You have a [27889 x 2] matrix containing values from 0 to 5. There are only 36 different possibilities of taking 2 out of 6 elem...

How to get random samples with certain distance between them?

You have a [27889 x 2] matrix containing values from 0 to 5. There are only 36 different possibilities of taking 2 out of 6 elem...

12 días ago | 1

| accepted

Answered

Index in position 2 exceeds array bounds

Profile_Y_new(1,end+k) = Profile_Y_new(1,end+k-1) + (mean(diff(Profile_Y))); This line must fail, because Profile_Y_new(1,end) ...

Index in position 2 exceeds array bounds

Profile_Y_new(1,end+k) = Profile_Y_new(1,end+k-1) + (mean(diff(Profile_Y))); This line must fail, because Profile_Y_new(1,end) ...

12 días ago | 0

| accepted

Answered

MATLAB is incredibly slow, even immediately after opening

Is only Matlab affected or do other programs suffer from the same problem also? Did this problem exist since you have installed...

MATLAB is incredibly slow, even immediately after opening

Is only Matlab affected or do other programs suffer from the same problem also? Did this problem exist since you have installed...

12 días ago | 0

Answered

average over a certain range of index ?

Another method assuming, that the intervals are dense and not overlapping: A = [1 7 12 20 23 31]; B = [6 11 19 22 30 35]; % A...

average over a certain range of index ?

Another method assuming, that the intervals are dense and not overlapping: A = [1 7 12 20 23 31]; B = [6 11 19 22 30 35]; % A...

13 días ago | 0

Answered

average over a certain range of index ?

nC = 1e6; % Number of elements of C nA = 1e5; % Number of intervals C = rand(1, nC); % Test data ...

average over a certain range of index ?

nC = 1e6; % Number of elements of C nA = 1e5; % Number of intervals C = rand(1, nC); % Test data ...

13 días ago | 0

Answered

How to plot vectors within in a for loop using a variable?

See: TUTORIAL: EVAL Using variables called x1, x2, ... hides an index in the names. Don't do this, because it is a shot in your...

How to plot vectors within in a for loop using a variable?

See: TUTORIAL: EVAL Using variables called x1, x2, ... hides an index in the names. Don't do this, because it is a shot in your...

13 días ago | 0

Answered

Tips on generating a subset of linspace(0,1,k)^n for "large" n and k.

See: FEX: VChooseKR (C-Mex) : k = 14; n = 12; % <= k A = linspace(0, 1, k); P = VChooseKR(uint8(k:-1:1), n); B = A(P); % ...

Tips on generating a subset of linspace(0,1,k)^n for "large" n and k.

See: FEX: VChooseKR (C-Mex) : k = 14; n = 12; % <= k A = linspace(0, 1, k); P = VChooseKR(uint8(k:-1:1), n); B = A(P); % ...

13 días ago | 0

| accepted

Answered

Thresholding based on smaller domains

Two solution: X = randi([0,10], 12, 12); % arbitrary test data n = 10; % Neighborhood Y = conv2(x, ones(n, n) / (n * n), 's...

Thresholding based on smaller domains

Two solution: X = randi([0,10], 12, 12); % arbitrary test data n = 10; % Neighborhood Y = conv2(x, ones(n, n) / (n * n), 's...

14 días ago | 0

Answered

how to divide matrix using mat2cell

Are you sure you need a cell array? If the chunks have the same size a numerical array is much more efficient: A = rand(1, 2199...

how to divide matrix using mat2cell

Are you sure you need a cell array? If the chunks have the same size a numerical array is much more efficient: A = rand(1, 2199...

14 días ago | 0

| accepted

Answered

How to treat with the error "Undefined function or variable 'M'." where M is mentioned in a Matlab ode function, and it's also a function of defined variables in the Matalb code?

Each function has its own worksapce, whereby "workspace" means the set of locally known variables. If you want to access a value...

How to treat with the error "Undefined function or variable 'M'." where M is mentioned in a Matlab ode function, and it's also a function of defined variables in the Matalb code?

Each function has its own worksapce, whereby "workspace" means the set of locally known variables. If you want to access a value...

14 días ago | 1

| accepted

Answered

Getting Error while using "im2gray" function. I'm using Matlab 2020.

Which Matlab version are you using? In the documentation: https://www.mathworks.com/help/matlab/ref/im2gray.html you find: I...

Getting Error while using "im2gray" function. I'm using Matlab 2020.

Which Matlab version are you using? In the documentation: https://www.mathworks.com/help/matlab/ref/im2gray.html you find: I...

14 días ago | 0

| accepted

Answered

Delete rows of a matrix based on specific column threshold values?

A = [ 1 2 1 2 3 2 1 1 2 3 4 3 1 4 2 4 3 2 5 2 5 2 3 4 3 2 4 6 4 3 2 4 2 4 2] index = A(:, 7) ...

Delete rows of a matrix based on specific column threshold values?

A = [ 1 2 1 2 3 2 1 1 2 3 4 3 1 4 2 4 3 2 5 2 5 2 3 4 3 2 4 6 4 3 2 4 2 4 2] index = A(:, 7) ...

14 días ago | 0

| accepted

Answered

Create new matrix based on grid location

A = [4 1 0.6; 4 1 0.8; 1 4 0.5; 1 3 0.3; 3 2 0.1; 2 1 0.6; ... 2 4 0.5; 3 2 0.4; 1 1 0.3; 1 2 0.1]; result = zeros(max(...

Create new matrix based on grid location

A = [4 1 0.6; 4 1 0.8; 1 4 0.5; 1 3 0.3; 3 2 0.1; 2 1 0.6; ... 2 4 0.5; 3 2 0.4; 1 1 0.3; 1 2 0.1]; result = zeros(max(...

14 días ago | 0

| accepted

Answered

Need help to create a function for a roulette simulation?

"If the ball lands on the field which the user choose" How does thze user choose a field? By the input n? This input is overwri...

Need help to create a function for a roulette simulation?

"If the ball lands on the field which the user choose" How does thze user choose a field? By the input n? This input is overwri...

14 días ago | 0

| accepted

Answered

Intersection of two matrices- intersect function not working as intended

With some guesses: L1S_T = readtable('L1S.xlsx','ReadVariableNames', 0); L1S = L1S_T.Variables; L1S = L1S(:, 1:3); L2S_T =...

Intersection of two matrices- intersect function not working as intended

With some guesses: L1S_T = readtable('L1S.xlsx','ReadVariableNames', 0); L1S = L1S_T.Variables; L1S = L1S(:, 1:3); L2S_T =...

14 días ago | 0

| accepted

Answered

In a vector, how to remove neighbours too close from one another

I assume a C-mex function is the best solution: // File: MovThresh.c // Compile: mex -O MoveThresh.c #include "mex.h" ...

In a vector, how to remove neighbours too close from one another

I assume a C-mex function is the best solution: // File: MovThresh.c // Compile: mex -O MoveThresh.c #include "mex.h" ...

15 días ago | 0

| accepted

Answered

Is there a way to define a default axis position, similar to defaultFigurePosition?

Yes. % A strange small size to be sure, that it works: set(groot, 'defaultAxesPosition', [0.25, 0.25, 0.2, 0.2]) figure; p...

Is there a way to define a default axis position, similar to defaultFigurePosition?

Yes. % A strange small size to be sure, that it works: set(groot, 'defaultAxesPosition', [0.25, 0.25, 0.2, 0.2]) figure; p...

15 días ago | 0

| accepted