Answered

Error: Error using dlfeval Value to differentiate must be a traced dlarray scalar.

Notice the example code has f = 100*(x(2) - x(1).^2).^2 + (1 - x(1)).^2; grad = dlgradient(f,x); so it is receiving an x (tha...

Error: Error using dlfeval Value to differentiate must be a traced dlarray scalar.

Notice the example code has f = 100*(x(2) - x(1).^2).^2 + (1 - x(1)).^2; grad = dlgradient(f,x); so it is receiving an x (tha...

5 minutes ago | 0

Answered

how to plot time-based x-axis?

numtime = 17; %or whatever timevals = linspace(0, maximum_time, numtime); arr_throughput_A = zeros(max_num_stream,numtim...

how to plot time-based x-axis?

numtime = 17; %or whatever timevals = linspace(0, maximum_time, numtime); arr_throughput_A = zeros(max_num_stream,numtim...

5 hours ago | 0

Answered

how to read and plot a .trc file?

The trc file you sent me is in Lecroy Binary Format. Fortunately someone has created code to read those. https://www.mathworks....

how to read and plot a .trc file?

The trc file you sent me is in Lecroy Binary Format. Fortunately someone has created code to read those. https://www.mathworks....

6 hours ago | 0

| accepted

Answered

Calling script from a function is recommended?

% bar.m fid = fopen('baz.m', 'w'); fprintf(fid,'beta = 1:1e6;\n'); fclose(fid) whos baz(); whos clearvars foo() whos ...

Calling script from a function is recommended?

% bar.m fid = fopen('baz.m', 'w'); fprintf(fid,'beta = 1:1e6;\n'); fclose(fid) whos baz(); whos clearvars foo() whos ...

6 hours ago | 0

Answered

[Feature request] "Run from Start to Here" button in Live Scripts

In the Live Editor, mouse over to the white border between the line numbers and the gray space for the code. A "Run to Here" but...

[Feature request] "Run from Start to Here" button in Live Scripts

In the Live Editor, mouse over to the white border between the line numbers and the gray space for the code. A "Run to Here" but...

6 hours ago | 0

| accepted

Answered

Filter or delete data from (time)table depending of missing values

[Copying answer down from comments] Snan = @(v)sum(v) + 0/(numel(v)==6); datasum = rmmissing(retime(data, 'hourly', Snan)); (...

Filter or delete data from (time)table depending of missing values

[Copying answer down from comments] Snan = @(v)sum(v) + 0/(numel(v)==6); datasum = rmmissing(retime(data, 'hourly', Snan)); (...

7 hours ago | 0

Answered

scatter3, stop the color changing after a second scatter3 command

When you use scatter3() and pass in a vector of color information, the information you pass in is not color indices into the cur...

scatter3, stop the color changing after a second scatter3 command

When you use scatter3() and pass in a vector of color information, the information you pass in is not color indices into the cur...

11 hours ago | 1

| accepted

Answered

using fzero to solve nonlinear equation

The function handle you pass to fzero() or to fsolve() must accept only one parameter. Your s0, vmax, and k are all known cons...

using fzero to solve nonlinear equation

The function handle you pass to fzero() or to fsolve() must accept only one parameter. Your s0, vmax, and k are all known cons...

13 hours ago | 0

Answered

filtering data from table

Close. TQTable = timetable(Time, Temperatuur, GlobalStraling);

filtering data from table

Close. TQTable = timetable(Time, Temperatuur, GlobalStraling);

13 hours ago | 0

| accepted

Answered

minor grid in consecutive plots

grid minor toggles the visibility of the minor grid lines. Minor grid lines lie between the tick marks. Not all types of charts ...

minor grid in consecutive plots

grid minor toggles the visibility of the minor grid lines. Minor grid lines lie between the tick marks. Not all types of charts ...

14 hours ago | 0

| accepted

Answered

loading a sequence of datasets using parfor

You need to synchronize with the GPU, and spend time transfering data to it, and wait for it to be ready, and read the data back...

loading a sequence of datasets using parfor

You need to synchronize with the GPU, and spend time transfering data to it, and wait for it to be ready, and read the data back...

15 hours ago | 0

Answered

Unable to perform assignment because the left and right sides have a different number of elements.

S = zeros(1,T/dt); S(1) = N; S is a vector. dS = ((-beta*(B/(B+k))*S(tt) + ub*(S(tt)+I(tt)+R(tt)) - ud*S) * dt)'; ...

Unable to perform assignment because the left and right sides have a different number of elements.

S = zeros(1,T/dt); S(1) = N; S is a vector. dS = ((-beta*(B/(B+k))*S(tt) + ub*(S(tt)+I(tt)+R(tt)) - ud*S) * dt)'; ...

15 hours ago | 0

| accepted

Answered

How to find and store each spot center position in the loop.

Use bw = bwareafilt(imbinarize(croppedImage), [10 inf]); Some of your images end up with very small extra regions, jus...

How to find and store each spot center position in the loop.

Use bw = bwareafilt(imbinarize(croppedImage), [10 inf]); Some of your images end up with very small extra regions, jus...

15 hours ago | 0

Answered

Plot time series data colored by color coded by ID

t = readtable('YourFile.csv'); [G, ID] = findgroups(t{:,1}); hold on h = splitapply(@plot, t{:,2}, t{:,3}, G); xlim auto; yl...

Plot time series data colored by color coded by ID

t = readtable('YourFile.csv'); [G, ID] = findgroups(t{:,1}); hold on h = splitapply(@plot, t{:,2}, t{:,3}, G); xlim auto; yl...

16 hours ago | 0

Answered

Switching between functions that have the same name

You do not need to restoredefaultpath but you do need to remove the previous folder You do, however, need to clear the class. ...

Switching between functions that have the same name

You do not need to restoredefaultpath but you do need to remove the previous folder You do, however, need to clear the class. ...

16 hours ago | 0

| accepted

Answered

How to stretch cos fit

axes([0 0.75 0.75 1.03]); %must do this before plot h(1) = scatter(xData, yData, 'b+', 'DisplayName', 'data'); hold on h(2)...

How to stretch cos fit

axes([0 0.75 0.75 1.03]); %must do this before plot h(1) = scatter(xData, yData, 'b+', 'DisplayName', 'data'); hold on h(2)...

17 hours ago | 0

Answered

subplot for 'controlchart' function

Use the 'parent' option ax(1) = subplot(2,1,1); plot(ax(1), rand(1,20)); ax(2) = subplot(2,1,2); load parts st = contro...

subplot for 'controlchart' function

Use the 'parent' option ax(1) = subplot(2,1,1); plot(ax(1), rand(1,20)); ax(2) = subplot(2,1,2); load parts st = contro...

17 hours ago | 1

Answered

Why symvar() sort 10 smaller than 9

symvar() sorts inconsistently if I recall correctly. It gets complicated when you start mixing numbers and underscores. For the...

Why symvar() sort 10 smaller than 9

symvar() sorts inconsistently if I recall correctly. It gets complicated when you start mixing numbers and underscores. For the...

17 hours ago | 0

Answered

How to use else if with ODE45 solver?

The mathematics used in the RK methods such as ode45(), require that for any one call the function be continuous and its first t...

How to use else if with ODE45 solver?

The mathematics used in the RK methods such as ode45(), require that for any one call the function be continuous and its first t...

17 hours ago | 0

Answered

How to avoid rounding error

A = [sym(10)^(-20) 1 ; 1 2] [L,U] = lu(A) L*U - A You can see from this that in order to get back A exactly, then you need a ...

How to avoid rounding error

A = [sym(10)^(-20) 1 ; 1 2] [L,U] = lu(A) L*U - A You can see from this that in order to get back A exactly, then you need a ...

17 hours ago | 0

| accepted

Answered

How to achieve identical timing of two side by side annotations

For anything like this you should probably be using the third party Psychtoolbox http://psychtoolbox.org/

How to achieve identical timing of two side by side annotations

For anything like this you should probably be using the third party Psychtoolbox http://psychtoolbox.org/

18 hours ago | 0

Answered

How to use movefile correct?

files = dir('/Users/haron/Desktop/Work/Haron/aprikose_edfs/*.edf.html'); for ii=1:length(files) oldname = fullfile(files(...

How to use movefile correct?

files = dir('/Users/haron/Desktop/Work/Haron/aprikose_edfs/*.edf.html'); for ii=1:length(files) oldname = fullfile(files(...

1 day ago | 0

| accepted

Answered

performing multiple elementwise operations at the same time

You would need the Parallel Computing Toolbox... and a flexible definition of "at the same time". It is unlikely to be worth th...

performing multiple elementwise operations at the same time

You would need the Parallel Computing Toolbox... and a flexible definition of "at the same time". It is unlikely to be worth th...

1 day ago | 0

Answered

what's the problem with my code ? Warning: Rank deficient, rank = 1, tol = 2.574115e-12.

for i = 1:n_pts+1 a = [X1 Y1]; Your X1 and Y1 do not change with the iterations, so your a will be the same for all iterations...

what's the problem with my code ? Warning: Rank deficient, rank = 1, tol = 2.574115e-12.

for i = 1:n_pts+1 a = [X1 Y1]; Your X1 and Y1 do not change with the iterations, so your a will be the same for all iterations...

1 day ago | 0

Answered

How to use #inlcude <>? # is declared as an invalid character!

MATLAB will not tell you that if your file extension is .c

How to use #inlcude <>? # is declared as an invalid character!

MATLAB will not tell you that if your file extension is .c

1 day ago | 2

| accepted

Answered

correlation between binary strings

R = sum((x - E).*(y - E)) ./ (sqrt(sum((x-E).^2)) .* sqrt(sum((y-E).^2)));

correlation between binary strings

R = sum((x - E).*(y - E)) ./ (sqrt(sum((x-E).^2)) .* sqrt(sum((y-E).^2)));

1 day ago | 0

Answered

Warning: Integer operands are required for colon operator when used as index.

If length(V2) is even, then length(V2)-1 is odd, and length(V2)-1)/2 would not be an integer when you do the 0:1: operation. Lik...

Warning: Integer operands are required for colon operator when used as index.

If length(V2) is even, then length(V2)-1 is odd, and length(V2)-1)/2 would not be an integer when you do the 0:1: operation. Lik...

1 day ago | 0

Answered

Need help to mask the image.

img = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/578172/untitled.jpg'); grimg = rgb2gray(img); bla...

Need help to mask the image.

img = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/578172/untitled.jpg'); grimg = rgb2gray(img); bla...

1 day ago | 0

Answered

Use the input arguments to load user-defined .mat files(2xn matrix) in the function.

A= load (varargin{1}); %to load first inputargument file name This assumes that when you called [Ans1,Ans2,Ans3,Ans4]= Data_fu...

Use the input arguments to load user-defined .mat files(2xn matrix) in the function.

A= load (varargin{1}); %to load first inputargument file name This assumes that when you called [Ans1,Ans2,Ans3,Ans4]= Data_fu...

1 day ago | 0

Answered

Calling Matlab from command line gives Caught unexpected exception of unknown type, why?

clear all; clear all asks MATLAB to destroy as much state as possible, leaving little more than what is stored in the current g...

Calling Matlab from command line gives Caught unexpected exception of unknown type, why?

clear all; clear all asks MATLAB to destroy as much state as possible, leaving little more than what is stored in the current g...

1 day ago | 0