A répondu
How can I get a variable that starts in t=0?
y(1, 1) = 500; % Set initial value before the loop for t = 1:249 % y(1, :) is defined already, so start at t=1, not t=0 ...

environ un an il y a | 1

A répondu
Most practical way to speed up calculations?
I've seen many examples in the forum, where the old and fundamental method of vectorization slows down the execution compared to...

environ un an il y a | 0

| A accepté

A répondu
How to create 4D array of images
Maybe this is enough: List = dir('C:\ParentOf_A_B_C', '**', '*.gif'); Array = []; for k = 1:numel(List) img = imread(fu...

environ un an il y a | 0

A répondu
How to perform derivative of a random signal without finite difference schemes?
You can try a Savitzky-Golay-Derivative filtering: https://www.mathworks.com/matlabcentral/fileexchange/30299-savitzky-golay-smo...

environ un an il y a | 0

A répondu
fprint f for a matrix
x = [0 3 0; 1 2 3]; c = sprintfc('%g', x.'); c(x.' == 0) = {''}; fprintf('\t%s\t%s\t%s\n', c{:}) % Or: s = compose("%g",...

environ un an il y a | 0

A répondu
How can I reuse numerical values them back as inputs?
Working with functions is the way to go. You cannot use Matlab efficiently without functions. But as far as I understand, your ...

environ un an il y a | 0

A répondu
Can I access local functions for unit testing
You can call subfunctions only from their main function. This impedes a unit-testing. But the main function can provide a functi...

environ un an il y a | 0

| A accepté

A répondu
why do I receive not enough input arguments
signal_avg_limt "(Dec20-1(cut4&2)_filter, 50, 094167" This calls the function with 1 argument: a string. I guess you mean this ...

environ un an il y a | 0

A répondu
Truncate strings to maximum length
Omit arrayfun: str = ["ab", "cdefg"]; extractBefore(str, min(4, str.strlength())+1) If this still looks to clumsy, write your...

environ un an il y a | 1

A répondu
How to share relatively large data among GUI callbacks?
50 MB is not a large array in times of Gigabytes of RAM. Sharing an array by guidata does not create deep copies, but Matlab use...

environ un an il y a | 0

A répondu
In what way is the new R2021b Editor UI "improved"?
I still miss the editor option existing inMatlab 6.5, which allowed to provide the selected text as input to functions defined b...

environ un an il y a | 0

A répondu
Decode a base64 code into a audio file and save it
Look into the output of the base64 decoding. You find these characters on the top: .E...B...B...B...B...B.. webmB...B....

environ un an il y a | 1

| A accepté

A répondu
Sort producing inconsistent results when re-ordering legend
lines = sort(findobj(gca,'type','Line')) This is a bad idea. findobj replies the handles to the line objects. To feed sort with...

environ un an il y a | 0

A répondu
How shift output of array
If the transformation should be linear, this is a multiplication: a = [-1, 1] b = a * pi But "[-1 -0.5 0 0.5 1] -----> [-p...

environ un an il y a | 0

A répondu
How to write ASCII characters corresponding to decimal numbers into a file?
This writes the character 'A' at the current file position: n = 65; fwrite(fid, n, 'char')

environ un an il y a | 0

A répondu
For loop to delete rows from matrix
M = randi([0, 5], 10000, 5); % Some test data P = M(M(:, 2) == 3, :); % Keep only rows, which have a 3 in 2nd column % ...

environ un an il y a | 0

A répondu
pass a struct through a loop to extract data and have the i in the loop added to the name
The best idea is to use an index as index: accuracy_totals(1).accuracy_total(i) Arrays are smarter than a pile of fields with ...

environ un an il y a | 1

| A accepté

A répondu
CELL2MAT does not support cell arrays containing cell arrays or objects
table2struct(direc); This line converts the table direc to a struct, but ignores the result. In consequence this line has no ef...

environ un an il y a | 0

A répondu
What is the most efficient way to "reverse" interpolate a 3D array?
Creating the grid matrices is not useful. The interpolation is about 10 times faster using the original vectors. % Omit: % [b...

environ un an il y a | 0

| A accepté

A répondu
I want to extract digits from a cell array but not the digit zero
data = readcell('https://www.mathworks.com/matlabcentral/answers/uploaded_files/1291690/Extract.xlsx'); nRow = height(data); ...

environ un an il y a | 1

| A accepté

A répondu
manual script for loop
MedComb(:,1) = 1:15; MedComb(1:15,2:6) = NaN; xcol = 20:24; for i1 = 1:2 for i2 = 0:1 [r, c] = find(tNino...

environ un an il y a | 0

| A accepté

A répondu
Why I'm getting this error( Array indices must be positive integers or logical values)?
When I run your code, it stops with the error, the w is undefined in the line: w(n+1) = w(n)+(2*0.01*e*[x(n),x(n+1),x(n+2)])% ...

environ un an il y a | 0

A répondu
How to get around using pack function in matlab 2022b?
The pack command is not useful anymore. Try to comment it out in the code. Asking the author is a good option also.

environ un an il y a | 0

| A accepté

A répondu
Invalid use of operator
The old problem: Strange methods to define names of variables dynamically using eval() demands for even stranger methods to acce...

environ un an il y a | 0

A répondu
How to check that these points formulate flat plane(on the same plane)?
P1 = [396326796.725069,-205153846.153846,0,0,0,0]; P2 = [-205153846.153846,396326796.725069,-205153846.153846,0,0,0]; P3 = [0,...

environ un an il y a | 1

A répondu
Monod nonlinear regression solved with Ode45
A guess: You call the function ParameterJack with 2 inputs: w=ParameterJack(ps,t); But the function requires 5: function dCdt...

environ un an il y a | 0

A répondu
How to plot a variable increasing in a for loop
If the plot should be expanded in each iteration, move the plot command inside the loop: axes('NextPlot', 'add'); % As hold('o...

environ un an il y a | 0

A répondu
How I can rotate cube the way that front plane will be come the top plane?
Use permute(planes, [2,1,3]) to move the 3D coordinates to the first dimension. Move the center of the body to the origin (or t...

environ un an il y a | 0

| A accepté

A répondu
Style in Matlab functions
I use the upper/lower case of the default setting: h = figure; set(h) The documentation explains, that the names and values a...

environ un an il y a | 0

A répondu
Arrays have incompatible sizes for this operation.
If you use a normal function instead of an anonymous function, you can use the debugger easily. function y = funy(r,theta,phi) ...

environ un an il y a | 0

Charger plus