Answered

Href hyperlink, how to escape double quotes " ?

I'm curious: % [UNTESTED] [TYPO FIXED] disp(['<a href="matlab:system(', ... 'strrep(''explorer.exe /select, $C:\My folde...

Href hyperlink, how to escape double quotes " ?

I'm curious: % [UNTESTED] [TYPO FIXED] disp(['<a href="matlab:system(', ... 'strrep(''explorer.exe /select, $C:\My folde...

2 months ago | 0

Answered

How to have different scales in the same x axis?

Set the XTickLabels accordingly with fake XTicks: X = [1,2,3,4,5,6, 100]; Y = rand(size(X)); axes('NextPlot', 'add', 'XTick',...

How to have different scales in the same x axis?

Set the XTickLabels accordingly with fake XTicks: X = [1,2,3,4,5,6, 100]; Y = rand(size(X)); axes('NextPlot', 'add', 'XTick',...

2 months ago | 0

Answered

Grouping the Elements of the Array

x = rand(897880, 1); nx = numel(x); len = 300000; tile = [repelem(len, floor(nx / len)), rem(nx, len)] xC = mat2cell...

Grouping the Elements of the Array

x = rand(897880, 1); nx = numel(x); len = 300000; tile = [repelem(len, floor(nx / len)), rem(nx, len)] xC = mat2cell...

2 months ago | 0

Answered

Can I run matlab, interacting with its GUI, on another PC?

This sounds like a job for the Parallel Server: https://www.mathworks.com/help/matlab-parallel-server/index.html?searchHighlight...

Can I run matlab, interacting with its GUI, on another PC?

This sounds like a job for the Parallel Server: https://www.mathworks.com/help/matlab-parallel-server/index.html?searchHighlight...

2 months ago | 1

Answered

[Beginer] How can I change a loop which depends on file's time into a one which depends on name's files ?

As far as I understand, you want to process a list of files in alphabetical order. This is the order replied by dir(), but unfor...

[Beginer] How can I change a loop which depends on file's time into a one which depends on name's files ?

As far as I understand, you want to process a list of files in alphabetical order. This is the order replied by dir(), but unfor...

2 months ago | 0

Answered

how to shift a subscript upwards in Matlab plot legend?

plot(1:10) legend('$V_c$', 'Interpreter', 'latex', 'FontSize', 15) figure plot(1:10) legend('$V_{\raisebox{1ex}{c}}$', 'In...

how to shift a subscript upwards in Matlab plot legend?

plot(1:10) legend('$V_c$', 'Interpreter', 'latex', 'FontSize', 15) figure plot(1:10) legend('$V_{\raisebox{1ex}{c}}$', 'In...

2 months ago | 0

Answered

Why am I not getting desired output?

neural_circuit function neural_circuit h = 0.05; t = 1:h:500; y0 = [2.5, 3.6, 9.5, 8.8, 2, 3, 7, 7.5]; % t(1) =0; y = ...

Why am I not getting desired output?

neural_circuit function neural_circuit h = 0.05; t = 1:h:500; y0 = [2.5, 3.6, 9.5, 8.8, 2, 3, 7, 7.5]; % t(1) =0; y = ...

2 months ago | 0

Answered

How to zero out short non-zero regions in vector?

With FEX: RunLength : A = [4 5 6 5 0 0 5 6 2 0 3 4 6 7 8 0 4 5 0 0 0 7 2 1 9 9 0]; minLen = 3; [b, n] = RunLength(A == 0); ...

How to zero out short non-zero regions in vector?

With FEX: RunLength : A = [4 5 6 5 0 0 5 6 2 0 3 4 6 7 8 0 4 5 0 0 0 7 2 1 9 9 0]; minLen = 3; [b, n] = RunLength(A == 0); ...

2 months ago | 0

Answered

How can I scan sets of multi variable in a simple version?

Take into account rounding errors: testing for cross(x,y)==0 is not stable. Remember, that the output of cross is a vector. So m...

How can I scan sets of multi variable in a simple version?

Take into account rounding errors: testing for cross(x,y)==0 is not stable. Remember, that the output of cross is a vector. So m...

2 months ago | 0

Answered

How to write this formula in Matlab

Ufin = sqrt((1 / n * sum(Ustat .^ 2))^2 + Ucalib .^ 2)

How to write this formula in Matlab

Ufin = sqrt((1 / n * sum(Ustat .^ 2))^2 + Ucalib .^ 2)

2 months ago | 0

Answered

how to sum cell elements in a dynamic cell table

Maybe: A = num2cell([1:6; 2:2:12; 3:3:18]); % Some test input S = size(A); % Size of the input ini = ones(1, S...

how to sum cell elements in a dynamic cell table

Maybe: A = num2cell([1:6; 2:2:12; 3:3:18]); % Some test input S = size(A); % Size of the input ini = ones(1, S...

2 months ago | 0

| accepted

Answered

why is this Matlab Code faster than the C++ code below? I want to understand what Matlab internally does better and faster than C++

Not an answer, but an improvement of the Matlab code, which run in 10.7 sec on my R2018b i5m instead of 13.0 sec of the original...

why is this Matlab Code faster than the C++ code below? I want to understand what Matlab internally does better and faster than C++

Not an answer, but an improvement of the Matlab code, which run in 10.7 sec on my R2018b i5m instead of 13.0 sec of the original...

2 months ago | 1

Answered

Hi every body, I write this code and I want to find a new Sol and Soll in iteration 1000 or more but the problem that the answer go to Nan?!

Use the debugger to find the iteration, which causes the NaNs: dbstop if naninf Then Matlab stops, when the first NaN occurs. ...

Hi every body, I write this code and I want to find a new Sol and Soll in iteration 1000 or more but the problem that the answer go to Nan?!

Use the debugger to find the iteration, which causes the NaNs: dbstop if naninf Then Matlab stops, when the first NaN occurs. ...

2 months ago | 0

Answered

Why is saveas() changing my image aspect ratio?

Try to set the 'PaperSize' property of the figure.

Why is saveas() changing my image aspect ratio?

Try to set the 'PaperSize' property of the figure.

2 months ago | 0

Answered

precision of double variables

Welcome to the world of numerics with limited precision. These are the expected effects. You observe the value mentioned in the...

precision of double variables

Welcome to the world of numerics with limited precision. These are the expected effects. You observe the value mentioned in the...

2 months ago | 0

Answered

Summation of every nth column

S = size(LoadProfile); X = reshape(LoadProfile, S(1), 4, S(2) / 4); X = reshape(sum(X, 2), S(1), S(2) / 4).'; Result = X(:);

Summation of every nth column

S = size(LoadProfile); X = reshape(LoadProfile, S(1), 4, S(2) / 4); X = reshape(sum(X, 2), S(1), S(2) / 4).'; Result = X(:);

2 months ago | 0

Answered

Why am I getting the error "not enough input arguments"?

The function handle provided to fminsearch must accept 1 input argument. fminsearch cannot guess, that H0 should be provided als...

Why am I getting the error "not enough input arguments"?

The function handle provided to fminsearch must accept 1 input argument. fminsearch cannot guess, that H0 should be provided als...

2 months ago | 0

Answered

Log Error and Warning Messages to Text File

You can catch errors using try-catch and write the messages whereever you want. Redirecting warnings is more tricky. I use my o...

Log Error and Warning Messages to Text File

You can catch errors using try-catch and write the messages whereever you want. Redirecting warnings is more tricky. I use my o...

2 months ago | 0

Answered

All tables being vertically concatenated must have the same number of variables.

I assume you want an "outer-join": https://www.mathworks.com/help/matlab/ref/outerjoin.html Output = table(); for kk = 1:nume...

All tables being vertically concatenated must have the same number of variables.

I assume you want an "outer-join": https://www.mathworks.com/help/matlab/ref/outerjoin.html Output = table(); for kk = 1:nume...

2 months ago | 0

Answered

Integration approximation with function handle

f = @(a,b,h,f0) ((a+(n-1)*h+a+n*h)/2)*f0; This cannot work if f0 is a function handle. This is at least confusing: for n=1:n ...

Integration approximation with function handle

f = @(a,b,h,f0) ((a+(n-1)*h+a+n*h)/2)*f0; This cannot work if f0 is a function handle. This is at least confusing: for n=1:n ...

2 months ago | 0

Answered

why do I get -Inf

alpha = 0.5; u0 = 0; a_k = @(k) (k + 1)^(1 - alpha) - (k)^(1 - alpha); n = 100; a = 0; b = 1; h = (b...

why do I get -Inf

alpha = 0.5; u0 = 0; a_k = @(k) (k + 1)^(1 - alpha) - (k)^(1 - alpha); n = 100; a = 0; b = 1; h = (b...

2 months ago | 1

| accepted

Answered

generate an independent seed with a fixed number

rng('default') is the default seed at the start of the Matlab session. All subsequent requesrts of random numbers move the see...

generate an independent seed with a fixed number

rng('default') is the default seed at the start of the Matlab session. All subsequent requesrts of random numbers move the see...

2 months ago | 0

Answered

imshow is not working

You have created a script called "image.m". This shadows the built-in function image. Shadowing built-in functions is a serious...

imshow is not working

You have created a script called "image.m". This shadows the built-in function image. Shadowing built-in functions is a serious...

2 months ago | 0

Answered

Can parfor be used in this context?

"Can I use parfor in a context where the second iteration depends on the results of the first iteration." No, you can't for obv...

Can parfor be used in this context?

"Can I use parfor in a context where the second iteration depends on the results of the first iteration." No, you can't for obv...

2 months ago | 0

| accepted

Answered

cell arrays not explicited

A = answer; % Why? You do this again here: for j = 1:numel(answer) % NUMEL is safer than LENGTH A{j} = answer{1,j}; ...

cell arrays not explicited

A = answer; % Why? You do this again here: for j = 1:numel(answer) % NUMEL is safer than LENGTH A{j} = answer{1,j}; ...

2 months ago | 0

Answered

How to label coins after recognizing them?

rgb = insertText(I,[prop.Centroid(i,1) prop.Centroid(i,2)],'5kr', ... 'FontSize',48,'TextColor','black'); This inserts the...

How to label coins after recognizing them?

rgb = insertText(I,[prop.Centroid(i,1) prop.Centroid(i,2)],'5kr', ... 'FontSize',48,'TextColor','black'); This inserts the...

2 months ago | 0

| accepted

Answered

Unable to open file You might not have write permission.

Does the file exist already? Is it opened by another process already? Can you delete in manually? Can you create a new file in t...

Unable to open file You might not have write permission.

Does the file exist already? Is it opened by another process already? Can you delete in manually? Can you create a new file in t...

2 months ago | 0

Answered

Not enough input arguments.

Do not provide parameters as appended variables in the ODE45 call: % In lya: [T,Y] = ode45(rhs_ext_fcn,[t t+stept],x,R); % ...

Not enough input arguments.

Do not provide parameters as appended variables in the ODE45 call: % In lya: [T,Y] = ode45(rhs_ext_fcn,[t t+stept],x,R); % ...

2 months ago | 0

Answered

simplify function does not work properly

syms kd z mean_t mean_t2 p assume(assumptions(),'clear'); eq = 8*kd^2*p^2*z*(mean_t - kd*mean_t2)^2 * ... (- mean_t^2 + m...

simplify function does not work properly

syms kd z mean_t mean_t2 p assume(assumptions(),'clear'); eq = 8*kd^2*p^2*z*(mean_t - kd*mean_t2)^2 * ... (- mean_t^2 + m...

2 months ago | 0

Answered

export .txt file

M = [ 4.12449 0.37223 0.89067 0.00000 0.00000 11492.2 1.000 1 17214 0.103]; [fid, msg] = fopen('answer.txt...

export .txt file

M = [ 4.12449 0.37223 0.89067 0.00000 0.00000 11492.2 1.000 1 17214 0.103]; [fid, msg] = fopen('answer.txt...

2 months ago | 0

| accepted