Risposto

Matlab GUI elements disappear on newer version of Matlab

The uibuttongroup hides objects, which have been created before in modern Matlab versions. Set a position of the uibuttongroup'...

Matlab GUI elements disappear on newer version of Matlab

The uibuttongroup hides objects, which have been created before in modern Matlab versions. Set a position of the uibuttongroup'...

8 giorni fa | 0

| accettato

Risposto

Identify lines that have a repetition (unique function)

data = [ 2.3300000e+02 3.5300000e+02 1.4912281e+00 2.3300000e+02 3.5200000e+02 1.4912281e+00 3.5300000e+0...

Identify lines that have a repetition (unique function)

data = [ 2.3300000e+02 3.5300000e+02 1.4912281e+00 2.3300000e+02 3.5200000e+02 1.4912281e+00 3.5300000e+0...

8 giorni fa | 0

Risposto

How Do I Replace Numbers with Alphabets

The solution is trivial: Simply write it down using CHAR vectors (not strings, which are enclosed in double quotes): n = 'ABCDE...

How Do I Replace Numbers with Alphabets

The solution is trivial: Simply write it down using CHAR vectors (not strings, which are enclosed in double quotes): n = 'ABCDE...

8 giorni fa | 1

Risposto

Matlab energy consumption greater than charger?

This is not a problem of Matlab, but your powersupply is too weak. Is it the original one delivered with the laptop? If so, it m...

Matlab energy consumption greater than charger?

This is not a problem of Matlab, but your powersupply is too weak. Is it the original one delivered with the laptop? If so, it m...

8 giorni fa | 0

Risposto

addPath does not take a vector from genpath

According to the documentation https://www.mathworks.com/help/matlab/ref/matlab.project.project.addpath.html addPath() takes one...

addPath does not take a vector from genpath

According to the documentation https://www.mathworks.com/help/matlab/ref/matlab.project.project.addpath.html addPath() takes one...

8 giorni fa | 0

| accettato

Risposto

How to rotate this 2d matrix with some angle ?

To define a rotation matrix, you need one angle in 2D (rotation around the Z axis) one angle and an axis of rotation in 3D on...

How to rotate this 2d matrix with some angle ?

To define a rotation matrix, you need one angle in 2D (rotation around the Z axis) one angle and an axis of rotation in 3D on...

9 giorni fa | 1

Risposto

mask a matrix based on values in two arrays

n = 1e4; u = floor(rand(10,1)*100); v = floor(rand(10,1)*100); tic % Original version: [x y] = meshgrid(linspace(0, 100, ...

mask a matrix based on values in two arrays

n = 1e4; u = floor(rand(10,1)*100); v = floor(rand(10,1)*100); tic % Original version: [x y] = meshgrid(linspace(0, 100, ...

9 giorni fa | 0

Risposto

Do not use the for loop to calculate the first number greater than 0 in each line

x = randn(10, 10) y = x.'; % Required for the last step y(y3==1) y1 = y > 0 y2 = cumsum(y1) % Now a row can contain mult...

Do not use the for loop to calculate the first number greater than 0 in each line

x = randn(10, 10) y = x.'; % Required for the last step y(y3==1) y1 = y > 0 y2 = cumsum(y1) % Now a row can contain mult...

9 giorni fa | 1

| accettato

Risposto

fprintf with complex numbers and ordinary arrays

This does not work without a loop. fprintf(' iteration number root estimates\n'); for k = 1:n fprintf('%10.0...

fprintf with complex numbers and ordinary arrays

This does not work without a loop. fprintf(' iteration number root estimates\n'); for k = 1:n fprintf('%10.0...

9 giorni fa | 1

| accettato

Risposto

What is the fastest way to export a large matrix of numbers from MATLAB to Excel (preferably as .xlsx) ?

Simply try it: M = magic(10^3); tic; writematrix(M, 'file1.xlsx'); toc tic; writecell(num2cell(M), 'file2.xlsx'); toc ...

What is the fastest way to export a large matrix of numbers from MATLAB to Excel (preferably as .xlsx) ?

Simply try it: M = magic(10^3); tic; writematrix(M, 'file1.xlsx'); toc tic; writecell(num2cell(M), 'file2.xlsx'); toc ...

9 giorni fa | 1

| accettato

Risposto

All is correct but this code gives error?

I guess boldly, that the code fails here: [pop(i,:),fxi(i,1)]=fminsearch(fitnessfun,pop(i,:),options,varargin{:}); ... fxi=fe...

All is correct but this code gives error?

I guess boldly, that the code fails here: [pop(i,:),fxi(i,1)]=fminsearch(fitnessfun,pop(i,:),options,varargin{:}); ... fxi=fe...

9 giorni fa | 0

Risposto

How do I insert a picture into a script?

It depends on how you would like to see the image. It cannot be displayed in the editor, because scripts are M-files and therefo...

How do I insert a picture into a script?

It depends on how you would like to see the image. It cannot be displayed in the editor, because scripts are M-files and therefo...

9 giorni fa | 0

Risposto

Downsampled data exceeds the input data

A linear interpolation avoids output points outside the range of input point. Use interp1 or the modern and faster griddedInterp...

Downsampled data exceeds the input data

A linear interpolation avoids output points outside the range of input point. Use interp1 or the modern and faster griddedInterp...

11 giorni fa | 0

Risposto

A very fast way to (i) concatenate and (ii) calculate the difference of elements?

a1 = datetime([ '2022-10-27 00:22:50.000' '2022-10-27 05:29:45.000' '2022-10-27 05:32:19.400' '2022-10-27 05:36:...

A very fast way to (i) concatenate and (ii) calculate the difference of elements?

a1 = datetime([ '2022-10-27 00:22:50.000' '2022-10-27 05:29:45.000' '2022-10-27 05:32:19.400' '2022-10-27 05:36:...

11 giorni fa | 1

| accettato

Risposto

Opening multiple instances of MATLAB causes endless folder access errors

What about allowing Matlab to access your documents folder?

Opening multiple instances of MATLAB causes endless folder access errors

What about allowing Matlab to access your documents folder?

11 giorni fa | 0

Risposto

title subplots within a for loop

Avoid the overkill of hold on commands. One per subplot is sufficient. What is the purpose of the "ll" here: title(ll,"(m)") ...

title subplots within a for loop

Avoid the overkill of hold on commands. One per subplot is sufficient. What is the purpose of the "ll" here: title(ll,"(m)") ...

11 giorni fa | 0

Risposto

Same code taking 15x longer to execute on a faster machine

n = 32000; % 7362497; dE00 = zeros(6, n,"single"); lab_NF = rand(6, 3, 'single'); labDB = rand(n, 3, 'single'); tic fo...

Same code taking 15x longer to execute on a faster machine

n = 32000; % 7362497; dE00 = zeros(6, n,"single"); lab_NF = rand(6, 3, 'single'); labDB = rand(n, 3, 'single'); tic fo...

11 giorni fa | 1

| accettato

Risposto

why does it has to be tedious to produce high quality figures for (academic) publications using MATLAB? (open Discussion)

My trivial answer: This is the nature of "high quality figures". Depending on the journal you are publishing in different proper...

why does it has to be tedious to produce high quality figures for (academic) publications using MATLAB? (open Discussion)

My trivial answer: This is the nature of "high quality figures". Depending on the journal you are publishing in different proper...

12 giorni fa | 0

Risposto

Converting cell to array data with specific string

data = {'[2, 11, 5, 0] '; '[1, 10, 6, 0] '; '[9, 3, 6, 0] '}; value = str2num(sprintf('%s;', data{:})) Internally str2num is ...

Converting cell to array data with specific string

data = {'[2, 11, 5, 0] '; '[1, 10, 6, 0] '; '[9, 3, 6, 0] '}; value = str2num(sprintf('%s;', data{:})) Internally str2num is ...

12 giorni fa | 0

Risposto

How to use nested FOR loop to create a matrix of answers?

thetaL = 3:3:90; VsL = 10:10:60; ... Other constants Result = NaN(numel(thetaL), numel(VsL)); for itheta = 1:numel(thetaL) ...

How to use nested FOR loop to create a matrix of answers?

thetaL = 3:3:90; VsL = 10:10:60; ... Other constants Result = NaN(numel(thetaL), numel(VsL)); for itheta = 1:numel(thetaL) ...

13 giorni fa | 0

| accettato

Risposto

How to merge very close bins in histogram/hiscounts

You can use FileExchange: RunLength to find the longest blocks of missing data: [b, n] = RunLength(x); match = (b == 0 & n > ...

How to merge very close bins in histogram/hiscounts

You can use FileExchange: RunLength to find the longest blocks of missing data: [b, n] = RunLength(x); match = (b == 0 & n > ...

13 giorni fa | 1

| accettato

Risposto

How to permanently disable warnings in MATLAB editor?

You can disable the MLint warnings directly in the editor with a right click on the concerned command: The disabling can concern...

How to permanently disable warnings in MATLAB editor?

You can disable the MLint warnings directly in the editor with a right click on the concerned command: The disabling can concern...

13 giorni fa | 1

Risposto

How do I find slope for large dataset?

The command gradient(x, t) solves this similar to diff(x) ./ diff(t), but with using the 2-sided difference except for the margi...

How do I find slope for large dataset?

The command gradient(x, t) solves this similar to diff(x) ./ diff(t), but with using the 2-sided difference except for the margi...

14 giorni fa | 1

Risposto

Error using plot Vectors must be the same length.

[x, y2] = lab_8_method_2(@lab_8, 0.3, [0 1], 0.01); plot(x, y2 ,'r'); hold on; [x, y4] = lab_8_method_4(@lab_8, 0.3, [0 1], ...

Error using plot Vectors must be the same length.

[x, y2] = lab_8_method_2(@lab_8, 0.3, [0 1], 0.01); plot(x, y2 ,'r'); hold on; [x, y4] = lab_8_method_4(@lab_8, 0.3, [0 1], ...

14 giorni fa | 0

Risposto

Find a number and range of group of the same number

With FileExchange: RunLength : a = [1 1 1 1 1 1 1 2 2 2 2 3 3 3 3 1 1 2 2 1 1 3 3 3 3 3 1 1 1 2 2 2]; [b, n, idx] = RunLength(...

Find a number and range of group of the same number

With FileExchange: RunLength : a = [1 1 1 1 1 1 1 2 2 2 2 3 3 3 3 1 1 2 2 1 1 3 3 3 3 3 1 1 1 2 2 2]; [b, n, idx] = RunLength(...

14 giorni fa | 1

Risposto

Hi ,I need some help with this PSO optimization code, "not enough input arguments "error message (Main pso used is The yarpiz's).

I'm not sure what you are asking for, but this is simplified version of your function without a loop: function Y1 = costfunctio...

Hi ,I need some help with this PSO optimization code, "not enough input arguments "error message (Main pso used is The yarpiz's).

I'm not sure what you are asking for, but this is simplified version of your function without a loop: function Y1 = costfunctio...

15 giorni fa | 0

Risposto

MEX func Error:"requires medical imaging toolbox" in Matlab R2022b

This seems to be an effect of Matlab's method to check, if you have a license for the used functions. This prevents the user fro...

MEX func Error:"requires medical imaging toolbox" in Matlab R2022b

This seems to be an effect of Matlab's method to check, if you have a license for the used functions. This prevents the user fro...

15 giorni fa | 0

Risposto

what happens with Matlab running training if my laptop eventually restarts for windows updates?

"I am scared if my laptop gets restarted automatically then I have to start the training all again" - if your code does not save...

what happens with Matlab running training if my laptop eventually restarts for windows updates?

"I am scared if my laptop gets restarted automatically then I have to start the training all again" - if your code does not save...

15 giorni fa | 0

| accettato

Risposto

Why " The boundary condition function BCFUN should return a column vector of length 5" error message is came?

You provide an extra parameter: solinit = bvpinit(linspace(0,1),[0;3;1;1],2); % ^ here...

Why " The boundary condition function BCFUN should return a column vector of length 5" error message is came?

You provide an extra parameter: solinit = bvpinit(linspace(0,1),[0;3;1;1],2); % ^ here...

15 giorni fa | 0

| accettato

Risposto

Table column of strings to a matrix.

A = ["[0 0 0 0 0 0 0 0]";"[0 0 0 0 0 0 0 0]";"[0 0 0 0 0 0 0 0]";"[1 1 1 1 1 1 1 1]"]; AC = char(A); AC(ismember(AC, '[] ')) =...

Table column of strings to a matrix.

A = ["[0 0 0 0 0 0 0 0]";"[0 0 0 0 0 0 0 0]";"[0 0 0 0 0 0 0 0]";"[1 1 1 1 1 1 1 1]"]; AC = char(A); AC(ismember(AC, '[] ')) =...

15 giorni fa | 1