Answered

Stop automatically showing "data tips"

Include this in the startup.m function: if ~verLessThan('MATLAB','9.7') set(groot, 'defaultAxesCreateFcn', @(ax,~) disable...

Stop automatically showing "data tips"

Include this in the startup.m function: if ~verLessThan('MATLAB','9.7') set(groot, 'defaultAxesCreateFcn', @(ax,~) disable...

7 days ago | 0

| accepted

Answered

How to call a function, como llamar una funcion

Insert the code into a file called "bissecion.m" and save it to a folder, which is included in the PATH. See: doc addpath Then...

How to call a function, como llamar una funcion

Insert the code into a file called "bissecion.m" and save it to a folder, which is included in the PATH. See: doc addpath Then...

7 days ago | 1

| accepted

Answered

Creation Machine olfaction (Electronic Nose) Toolbox!

Dear Meisam Vajdi, This is the public Matlab forum mainly supported by voluntary Matlab users. We cannot influence the developm...

Creation Machine olfaction (Electronic Nose) Toolbox!

Dear Meisam Vajdi, This is the public Matlab forum mainly supported by voluntary Matlab users. We cannot influence the developm...

7 days ago | 1

Answered

Summation with For LOOP (iterations)

K = [56, 0.65, 0.175, 0.055]; Z = [0.5, 0.1, 0.15, 0.25]; fcn = @(x) sum(Z .* (K - 1) ./ (1 + x * (K - 1))) fzero(fcn, 0.5) ...

Summation with For LOOP (iterations)

K = [56, 0.65, 0.175, 0.055]; Z = [0.5, 0.1, 0.15, 0.25]; fcn = @(x) sum(Z .* (K - 1) ./ (1 + x * (K - 1))) fzero(fcn, 0.5) ...

7 days ago | 0

Answered

I can't get my code to run

The error message is clear: "File not found." There is no file called: 'D:\UNI\2021\ERB302 Applied Geophysics\CodeImages\Data...

I can't get my code to run

The error message is clear: "File not found." There is no file called: 'D:\UNI\2021\ERB302 Applied Geophysics\CodeImages\Data...

7 days ago | 0

Answered

How can I copy one row to the another row?

A = [5 6 7 8 9 0 1 2 3 4; 5 6 7 8 9 0 1 2 3 4; 5 6 7 8 9 0 1 2 3 4; 5 6 7 8 9 0 1 2 3 4; 5 6 7 8 9 0 1 2...

How can I copy one row to the another row?

A = [5 6 7 8 9 0 1 2 3 4; 5 6 7 8 9 0 1 2 3 4; 5 6 7 8 9 0 1 2 3 4; 5 6 7 8 9 0 1 2 3 4; 5 6 7 8 9 0 1 2...

7 days ago | 0

| accepted

Answered

Fast implementation of max-plus matrix multiplication

A C-mex version: [EDITED: Check of type double is added] // mp_prod_mex.c // C = mp_prod_mex(A, B) // INPUT: A, B: Real dou...

Fast implementation of max-plus matrix multiplication

A C-mex version: [EDITED: Check of type double is added] // mp_prod_mex.c // C = mp_prod_mex(A, B) // INPUT: A, B: Real dou...

7 days ago | 2

| accepted

Answered

Selecting element at same position in a matrix

If you need the indices again, store them in variables: i1 = randi([1, size(VID1, 1)]); i2 = randi([1, size(VID1, 2)]); ID1...

Selecting element at same position in a matrix

If you need the indices again, store them in variables: i1 = randi([1, size(VID1, 1)]); i2 = randi([1, size(VID1, 2)]); ID1...

7 days ago | 0

| accepted

Answered

Transform 3D binary matrix into 2D

Your code overwrites the output for each loop over i=1:lev. An equivalent code without a loop: %seg2 = seg1(:, :, end); What s...

Transform 3D binary matrix into 2D

Your code overwrites the output for each loop over i=1:lev. An equivalent code without a loop: %seg2 = seg1(:, :, end); What s...

7 days ago | 0

Answered

Rewrite Matlab ODE into Python - IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

The error message tells, that res replied by simVirusSpreading() is a vector, but you try to access it as a matrix with 2 indice...

Rewrite Matlab ODE into Python - IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed

The error message tells, that res replied by simVirusSpreading() is a vector, but you try to access it as a matrix with 2 indice...

7 days ago | 0

Answered

Error using randi Size inputs must be scalar (Matlab)

"C is the random subset of B of size Ai" : for i = 1:n % Without repetitions: C = B(randperm(numel(B), A(i))); % O...

Error using randi Size inputs must be scalar (Matlab)

"C is the random subset of B of size Ai" : for i = 1:n % Without repetitions: C = B(randperm(numel(B), A(i))); % O...

8 days ago | 0

| accepted

Answered

Force begin/end slope of trendline scatterplot

See: https://www.mathworks.com/matlabcentral/answers/94272-how-do-i-constrain-a-fitted-curve-through-specific-points-like-the-o...

Force begin/end slope of trendline scatterplot

See: https://www.mathworks.com/matlabcentral/answers/94272-how-do-i-constrain-a-fitted-curve-through-specific-points-like-the-o...

8 days ago | 0

| accepted

Answered

How to take precalculated variables in a function, without defining the variables within said function?

You have defined the function down() with input arguments. Then use them: A = T/(0.5*R*V^2*AR); if(F~= 0); M = F/V; ...

How to take precalculated variables in a function, without defining the variables within said function?

You have defined the function down() with input arguments. Then use them: A = T/(0.5*R*V^2*AR); if(F~= 0); M = F/V; ...

8 days ago | 0

| accepted

Answered

Matlab doesn't open (it's installed and activated)

If you are running Matlab 2020b, the folder is not called "R2018a", but "R2020b". Insert this in the Windows Explorer's address ...

Matlab doesn't open (it's installed and activated)

If you are running Matlab 2020b, the folder is not called "R2018a", but "R2020b". Insert this in the Windows Explorer's address ...

9 days ago | 0

Answered

Terminate while loop when user hits enter

Avoid repeating code: disp('Begin entering the data points') t = 0; while true % Infinite loop x_point = input('ente...

Terminate while loop when user hits enter

Avoid repeating code: disp('Begin entering the data points') t = 0; while true % Infinite loop x_point = input('ente...

9 days ago | 1

| accepted

Answered

How to Open a Folder

Maybe you want to open a file inside this folder? function main myPath = fileparts(mfilename('fullpath')); % Folder of ...

How to Open a Folder

Maybe you want to open a file inside this folder? function main myPath = fileparts(mfilename('fullpath')); % Folder of ...

9 days ago | 0

Answered

how to grab the last value in a loop?

In your first code: seno_m(i,1)= nanmean(sin(Date_wd_daily(B(i):B(i)-1,9))); % ^^^^ ^^^^^...

how to grab the last value in a loop?

In your first code: seno_m(i,1)= nanmean(sin(Date_wd_daily(B(i):B(i)-1,9))); % ^^^^ ^^^^^...

9 days ago | 0

| accepted

Answered

Human Neuromechanics, ERROR IN CODE

The failing part of the code: % Jacobian Jacobian = @(q) [-Length_S * sin(q(1,:,:)) - Length_E * sin(q(1,:,:) + q(2,:,:)), ......

Human Neuromechanics, ERROR IN CODE

The failing part of the code: % Jacobian Jacobian = @(q) [-Length_S * sin(q(1,:,:)) - Length_E * sin(q(1,:,:) + q(2,:,:)), ......

9 days ago | 0

Answered

Matrix construction over a loop

Maybe you want: for i = 1:length(x) A(i) = a * b / x(i); B(i) = c + A(i) / b; D(i) = a + b; E(i) = 1 - 2 * c; .....

Matrix construction over a loop

Maybe you want: for i = 1:length(x) A(i) = a * b / x(i); B(i) = c + A(i) / b; D(i) = a + b; E(i) = 1 - 2 * c; .....

9 days ago | 0

Answered

Calculating standard deviation for each year

Do you want: vola2 = splitapply(@(x) std(x, 'omitnan'), stocks.RET, group);

Calculating standard deviation for each year

Do you want: vola2 = splitapply(@(x) std(x, 'omitnan'), stocks.RET, group);

9 days ago | 0

| accepted

Answered

How to stop MATLAB from opening every time I switch on my computer?

This is not a problem of Matlab, but a feature of the operating system. So this question is actually off-topic. Open the contro...

How to stop MATLAB from opening every time I switch on my computer?

This is not a problem of Matlab, but a feature of the operating system. So this question is actually off-topic. Open the contro...

9 days ago | 1

Answered

Change keyboard shortcut for terminate code while running in Mac OS Matlab 2020

The shortcut for stopping the execution is controlled by the operating system. You cannot modify it from inside an application. ...

Change keyboard shortcut for terminate code while running in Mac OS Matlab 2020

The shortcut for stopping the execution is controlled by the operating system. You cannot modify it from inside an application. ...

9 days ago | 0

Answered

Storing values in an array from function file called by ode15s solver

The code is very confusing. The relative tolerance of 5.421011e5 is extremely huge. Are you sure that this is meaningful in you...

Storing values in an array from function file called by ode15s solver

The code is very confusing. The relative tolerance of 5.421011e5 is extremely huge. Are you sure that this is meaningful in you...

9 days ago | 0

Answered

Calling C++ mex in loop crashes Matlab

There is a time delay between the check of !isWriting and setting isReading = 1. This is a racing condition. Use a thread-safe s...

Calling C++ mex in loop crashes Matlab

There is a time delay between the check of !isWriting and setting isReading = 1. This is a racing condition. Use a thread-safe s...

9 days ago | 0

Answered

Making script execution go faster

Avoid scripts but use functions. This can increase the speed substantially, but most of all the clarity and maintanability of th...

Making script execution go faster

Avoid scripts but use functions. This can increase the speed substantially, but most of all the clarity and maintanability of th...

9 days ago | 0

| accepted

Answered

How to access alternate elements from a matrrix?

a = [0 4 5 6 7; ... 0 0 0 0 0] n = size(a, 2); for i = 1:n / 2 k = (i - 1) * 2...

How to access alternate elements from a matrrix?

a = [0 4 5 6 7; ... 0 0 0 0 0] n = size(a, 2); for i = 1:n / 2 k = (i - 1) * 2...

9 days ago | 0

| accepted

Answered

Why am I getting the error, "Array indices must be positive integers or logical values."

What is "squeeze"? Did you shadow the function by defining it as variable? The left hand side of an assignment cannot be a func...

Why am I getting the error, "Array indices must be positive integers or logical values."

What is "squeeze"? Did you shadow the function by defining it as variable? The left hand side of an assignment cannot be a func...

10 days ago | 0

| accepted

Answered

Extracting Data from Over 600 .nc Files...

See: FAQ: How to process a sequence of files Folder = 'C:\Your\Data\Folder'; FileList = dir(fullfile(Folder, '*.nc')); for iF...

Extracting Data from Over 600 .nc Files...

See: FAQ: How to process a sequence of files Folder = 'C:\Your\Data\Folder'; FileList = dir(fullfile(Folder, '*.nc')); for iF...

10 days ago | 1

| accepted

Answered

How can I take the value from an equation and plug it back into the same equation? (Newton-Raphson)

Replace E = D - F(D)/F'(D) by D = D - F(D)/F'(D) For the 2nd part: You have defined the function with inputs: function [A...

How can I take the value from an equation and plug it back into the same equation? (Newton-Raphson)

Replace E = D - F(D)/F'(D) by D = D - F(D)/F'(D) For the 2nd part: You have defined the function with inputs: function [A...

10 days ago | 0

Answered

cant display my new image

imshow does not accept cell arrays as input. It needs a matrix. Either create this matrix directly: d = repmat(a, 30, 30); or...

cant display my new image

imshow does not accept cell arrays as input. It needs a matrix. Either create this matrix directly: d = repmat(a, 30, 30); or...

10 days ago | 1

| accepted