Answered

How should I store data from my parfor loop as to reduce runtime?

Appending data to a table like that is expensive. If your data is all the same datatype, store your data in arrays, and then co...

How should I store data from my parfor loop as to reduce runtime?

Appending data to a table like that is expensive. If your data is all the same datatype, store your data in arrays, and then co...

2 hours ago | 0

Answered

Octree implementation for point cloud data

https://www.mathworks.com/help/stats/kdtreesearcher.html kdtree for data dimensions up to 10 default to building trees, so pas...

Octree implementation for point cloud data

https://www.mathworks.com/help/stats/kdtreesearcher.html kdtree for data dimensions up to 10 default to building trees, so pas...

2 hours ago | 0

Answered

How to convert arc circle plot into binary circle?

https://matlab.fandom.com/wiki/FAQ#How_do_I_create_an_arc.3F shows how to create an arc. But for your purpose, instead of using...

How to convert arc circle plot into binary circle?

https://matlab.fandom.com/wiki/FAQ#How_do_I_create_an_arc.3F shows how to create an arc. But for your purpose, instead of using...

2 hours ago | 0

Answered

Maximum recursion limit of 500 reached.

You have accidentally named one of your own functions the same as a function used by MATLAB graphics, and every time MATLAB goes...

Maximum recursion limit of 500 reached.

You have accidentally named one of your own functions the same as a function used by MATLAB graphics, and every time MATLAB goes...

2 hours ago | 0

Answered

integral of a matrix

format long g M = ones(3,3); Dmat = [1;2;3]; fun = @(t)expm(-M.*t)*Dmat; T = 1e-2; g = integral(fun,0,T,'ArrayValued',true)...

integral of a matrix

format long g M = ones(3,3); Dmat = [1;2;3]; fun = @(t)expm(-M.*t)*Dmat; T = 1e-2; g = integral(fun,0,T,'ArrayValued',true)...

3 hours ago | 0

| accepted

Answered

Matlab CSV data and if statement

Use discretize() to classify the data according to ranges of values. Then you can use the returned range number to index a list ...

Matlab CSV data and if statement

Use discretize() to classify the data according to ranges of values. Then you can use the returned range number to index a list ...

3 hours ago | 1

| accepted

Answered

Error using plot Invalid first data argument.

MATLAB has a feature known as "command / function duality". Any time you see a line of the form WORD1 WORD2 .... WORDN and t...

Error using plot Invalid first data argument.

MATLAB has a feature known as "command / function duality". Any time you see a line of the form WORD1 WORD2 .... WORDN and t...

3 hours ago | 0

Answered

Problems in Parfor Implemenation

Change v_poli(s,:) = interp1(b, v, b_grid, 'linear', 'extrap'); % true v_t+1 v_poli(v_poli>0)=-1e-6; to...

Problems in Parfor Implemenation

Change v_poli(s,:) = interp1(b, v, b_grid, 'linear', 'extrap'); % true v_t+1 v_poli(v_poli>0)=-1e-6; to...

3 hours ago | 0

Answered

Overview variables at the beginning

https://www.mathworks.com/help/matlab/matlab_prog/format-live-scripts.html shows you how you can use the LiveScript editor to in...

Overview variables at the beginning

https://www.mathworks.com/help/matlab/matlab_prog/format-live-scripts.html shows you how you can use the LiveScript editor to in...

3 hours ago | 0

| accepted

Answered

Error using fmincon, the function cannot continue

aymax = 5; V = 70; deltay = 60; deltax = 3; intorno = sqrt(deltax^2+deltay^2); dmin = 3; rof1 = optimvar('rof1'); rof2...

Error using fmincon, the function cannot continue

aymax = 5; V = 70; deltay = 60; deltax = 3; intorno = sqrt(deltax^2+deltay^2); dmin = 3; rof1 = optimvar('rof1'); rof2...

4 hours ago | 0

Answered

error of vector must be same length

PIP, PEEP, opmin ,opmax are all constants, so recruitment() invoked on those is always going to return the same thing. p = y(:,...

error of vector must be same length

PIP, PEEP, opmin ,opmax are all constants, so recruitment() invoked on those is always going to return the same thing. p = y(:,...

4 hours ago | 0

Answered

How can calculate the matrix inverse

C=D*R*D' implies that C * inv(D') = D * R inv(D) * C * inv(D') = R so R = D\C/D';

How can calculate the matrix inverse

C=D*R*D' implies that C * inv(D') = D * R inv(D) * C * inv(D') = R so R = D\C/D';

5 hours ago | 0

| accepted

Answered

automated variable highlighting/ code highlighting doesn't work anymore

I have a vague memory that the Code Analyzer (used to be called mlint https://www.mathworks.com/help/matlab/ref/mlint.html ) has...

automated variable highlighting/ code highlighting doesn't work anymore

I have a vague memory that the Code Analyzer (used to be called mlint https://www.mathworks.com/help/matlab/ref/mlint.html ) has...

7 hours ago | 0

Answered

'solve' not working as expected for Log Equations

if you vpasolve() and use a low enough start then it will find a solution ss=vpasolve([f1,f2],[n,k], [.8999999040792;1]) The s...

'solve' not working as expected for Log Equations

if you vpasolve() and use a low enough start then it will find a solution ss=vpasolve([f1,f2],[n,k], [.8999999040792;1]) The s...

10 hours ago | 1

| accepted

Answered

How to sum over indices i+j=k without using a for loop?

If you have i+j = k, then you start at row k-1, column 1 as the first point (if k >= the number of rows). The next point would b...

How to sum over indices i+j=k without using a for loop?

If you have i+j = k, then you start at row k-1, column 1 as the first point (if k >= the number of rows). The next point would b...

1 day ago | 0

Answered

compress audio signal recorded in GUI

%one way of compressing compressed_mr1 = mr(1:2:end,:); %another way of compressing compressed_mr2 = resample(mr(:,1), 8000...

compress audio signal recorded in GUI

%one way of compressing compressed_mr1 = mr(1:2:end,:); %another way of compressing compressed_mr2 = resample(mr(:,1), 8000...

1 day ago | 0

Answered

Hi; i need help please. I want to multiply the 5 slices i chose from image vol (1) * slices from image vol (3) and (img2 * img4) this program displays as (img2 * img4) , I wan

You have for p=1:2:3 jpgfiles=dir(fullfile(a,'\*.nii*')); n=numel(jpgfiles(p)); im=jpgfiles(p).name img...

Hi; i need help please. I want to multiply the 5 slices i chose from image vol (1) * slices from image vol (3) and (img2 * img4) this program displays as (img2 * img4) , I wan

You have for p=1:2:3 jpgfiles=dir(fullfile(a,'\*.nii*')); n=numel(jpgfiles(p)); im=jpgfiles(p).name img...

1 day ago | 0

Answered

How do I change the Input data of the Constant Block When the sampling time comes?

You would have to use sim() after having set a termination time on the model. Then you would set_param() to set the conditions o...

How do I change the Input data of the Constant Block When the sampling time comes?

You would have to use sim() after having set a termination time on the model. Then you would set_param() to set the conditions o...

1 day ago | 0

| accepted

Answered

How to determine number of rows in an excel sheet without uploading it into matlab

filename = 'YourFile.csv'; lines_in_file = -inf; if isunix() %mac or linux cmd = sprintf('wc -l "%s"', filename); ...

How to determine number of rows in an excel sheet without uploading it into matlab

filename = 'YourFile.csv'; lines_in_file = -inf; if isunix() %mac or linux cmd = sprintf('wc -l "%s"', filename); ...

1 day ago | 0

Answered

Upload files to Matlab cluster

Im using matlab cluster (AWS based) What operating system is the AWS running? My understanding is that AWS clusters are mostly ...

Upload files to Matlab cluster

Im using matlab cluster (AWS based) What operating system is the AWS running? My understanding is that AWS clusters are mostly ...

2 days ago | 0

Answered

Undefined variable in a self-written function

integrand = @(d) langevin(d).*distribution(d).*(pi/6)*d.^3; para = A*integral(integrand,0,200e-9)+C.*x;

Undefined variable in a self-written function

integrand = @(d) langevin(d).*distribution(d).*(pi/6)*d.^3; para = A*integral(integrand,0,200e-9)+C.*x;

2 days ago | 0

Answered

Error in converting binary to audio after recording the audio and converting it into binary .......KINDLY HELP!!

format long g myRecording = randn(5,1) wavebinary = dec2bin( typecast( single(myRecording(:)), 'uint16'), 16 ) - '0'; size(...

Error in converting binary to audio after recording the audio and converting it into binary .......KINDLY HELP!!

format long g myRecording = randn(5,1) wavebinary = dec2bin( typecast( single(myRecording(:)), 'uint16'), 16 ) - '0'; size(...

2 days ago | 0

| accepted

Answered

How to push a first whites (which is not equal to 0) elements from the mask image into the vector array to make line over stored points.

iminarize(), bwareafilt() After that if your binary image is BW, then first_white_row_idx = sum(cumprod(~BW,1)) + 1 but be c...

How to push a first whites (which is not equal to 0) elements from the mask image into the vector array to make line over stored points.

iminarize(), bwareafilt() After that if your binary image is BW, then first_white_row_idx = sum(cumprod(~BW,1)) + 1 but be c...

2 days ago | 1

| accepted

Answered

Generating a normal distrbution random numbers and setting them to catagories

Asum = Asum+a(n) You have a(n)=r(n); Suppose it is true for n = 2 and 5. Then assigning to a(2) would create a(1) ...

Generating a normal distrbution random numbers and setting them to catagories

Asum = Asum+a(n) You have a(n)=r(n); Suppose it is true for n = 2 and 5. Then assigning to a(2) would create a(1) ...

3 days ago | 0

Answered

Why am I Unable to use Datetime Ticks for UIAxes in MATLAB App Designer?

It is possible to plot datetime in app designer. dt = datetime('now') - days(1:5) r = rand(1,5) fig = uifigure() ax = uiaxes...

Why am I Unable to use Datetime Ticks for UIAxes in MATLAB App Designer?

It is possible to plot datetime in app designer. dt = datetime('now') - days(1:5) r = rand(1,5) fig = uifigure() ax = uiaxes...

3 days ago | 0

| accepted

Answered

Error using unzip (line 84)

The file is not zip and is not gzip either. If you happen to be using Mac or Linux, then rename the file to end with .Z and the...

Error using unzip (line 84)

The file is not zip and is not gzip either. If you happen to be using Mac or Linux, then rename the file to end with .Z and the...

3 days ago | 1

| accepted

Answered

What's the alternative of DisplayName in App Designer?

Tested. fig = uifigure(); ax = axes(fig); h = plot(ax, rand(1,5), 'displayname', 'test'); legend(ax, 'show') The key here i...

What's the alternative of DisplayName in App Designer?

Tested. fig = uifigure(); ax = axes(fig); h = plot(ax, rand(1,5), 'displayname', 'test'); legend(ax, 'show') The key here i...

3 days ago | 1

| accepted

Answered

Change color of numbers at colorbar

surf(rand(5)) colormap(turbo) hcb = colorbar; hcb.Ruler.TickLabelFormat = '\\color{red}%g'; The double \\ is important for t...

Change color of numbers at colorbar

surf(rand(5)) colormap(turbo) hcb = colorbar; hcb.Ruler.TickLabelFormat = '\\color{red}%g'; The double \\ is important for t...

3 days ago | 0

Answered

How can I add path in Matlab to read files csv and excel files from specific folder and read the data?

filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/655500/WT_%20-%2010-15.csv'; t = readtable(filenam...

How can I add path in Matlab to read files csv and excel files from specific folder and read the data?

filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/655500/WT_%20-%2010-15.csv'; t = readtable(filenam...

3 days ago | 0

| accepted

Answered

MatLab crashes when I insert a large dataset that I am assigning to a matrix

In the main MATLAB command window, Preferences -> MATLAB -> General -> Java Heap Memory and increase the memory allocation. Yo...

MatLab crashes when I insert a large dataset that I am assigning to a matrix

In the main MATLAB command window, Preferences -> MATLAB -> General -> Java Heap Memory and increase the memory allocation. Yo...

3 days ago | 0