Answered
How to delete columns from a matrix, conditionally?
keep = sum(~isnan(data), 1) >= 100; data = data(:, keep); Your approach does not work, because the matrix data is changed, but...

13 dagen ago | 0

| accepted

Answered
How to call a value from the command window to the editor window
Is it really a small integer? Then simply type "123". If it is a much more complicated nested struct, please explain this. It ma...

13 dagen ago | 1

Answered
Matlab: In for loop, change name of variable
This is a very bad idea. The severe problems caused by the dynamic creation of variables have been discussed in the forum exhaus...

13 dagen ago | 0

Answered
Avoiding drift while creating angular rotation with variable degree increments
Let's start with a simplification of the code: phi = 90; angle = 16; ddeg_min = 0.1; ddeg_max = 10; deg(1) = 0;...

13 dagen ago | 0

| accepted

Answered
how can I use a loop instead of cellfun
Why do you want to use a loop? To improve the speed? Then there are better methods: cellfun('isempty', f1) is faster than cellf...

14 dagen ago | 0

Answered
Slower processing of arrays in structures and pre-allocation
In the first example, the pre-allocation accelerates the code by about 0.15 seconds. With using a field of a struct, the benefi...

15 dagen ago | 0

Answered
What toolbox is required for allpaths() built-in command?
The documentation looks, like allpaths belongs to Matlab's standard toolbox, but it was introduced in R2021a. Which Matlab versi...

16 dagen ago | 0

| accepted

Answered
How to create a diagonal matrix that starts at (1,1)?
Maybe you mean: n = 4; lambda = 0.2; A = eye(n) * lambda % Or: A = diag(repmat(lambda, 1, n))

16 dagen ago | 0

Answered
How to extract N array from a for loop?
The question is not really clear to me. With some guessing: a = cell(1, 2); % Pre-allocate for i = 1:2 x = input('ent...

16 dagen ago | 1

Answered
How to solve second order coupled ODEs with bvp4c?
function dy = YourODE(t, y) k = 17; dy = [y(3); ... y(4); k * y(1) * y(2); ... k * y(1) * y(2)]; end I...

18 dagen ago | 0

| accepted

Answered
i want to solve that system using 4 order kutta method
The output is a simple point at [0, 0]. You start at 0. Then the expression x2/(x2/20) + 1 is NaN, because you divide by 0: x2...

19 dagen ago | 2

| accepted

Answered
repmat usage for cellarray
If this is what you want: cell_array = PG01 PG02 PG03 . . . PG32 PG01 PG02 PG03 . . . PG32 . . ...

19 dagen ago | 0

| accepted

Answered
GA optimisation how to find maxima instad of minima.
(The only way I found is to put a minus in the y(1) equation.) This is the perfect solution already.

19 dagen ago | 0

| accepted

Answered
How to make uicontrol edit box only show the text when needed?
You can simply delete the 'String' property of the text box, when the checkbox is disabled and store the contents e.g. in the Us...

19 dagen ago | 0

Answered
solving second order differential equation using ode45
Convert the 2nd order equation into a set of 1st order equations: dy(1) = y(2); dy(2) = (1 - y(1)^2) * y(2) - y(1); See: http...

19 dagen ago | 0

Answered
Problem with RC5 Image encryption
For images, "plain text" means the sequence of bytes. Import the image file by fopen&fread(fid, Inf, '*uint8'), not by imread()....

19 dagen ago | 0

Answered
Is is possible to leave the dialog box created with inputs open after clicking ok?
Yes. Simply create a dialog box which have an "Apply" button. That "Ok" closes the dialog is the standard look&feel, so changing...

19 dagen ago | 0

| accepted

Answered
Turning a sequence of operations into a function
Start with simplifying the code: k is i+1 in all cases, so omit k and use i+1. Pre-allocate f1 by zeros() to avoid n iterative...

19 dagen ago | 0

Answered
Getting the 3 lowest values in a vector Matlab
a = [12,3,9, 5.6, 9, 10, 7]; b = mink(a, 3)

20 dagen ago | 0

Answered
How can i perform for loop in this case?
x = rand(51, 1); M = repmat(x, 1, 71, 3); size(M)

20 dagen ago | 0

Answered
While loop to find index of first element to be less than and greater than in a vector
It is impossible, that a number is smaller than 0.42 and greater than 0.52: a(n) < 0.42 && a(n) > 0.52 % ^ ^ ...

21 dagen ago | 0

Answered
Trying to fix the loop
nFail = 0; for n = 1:5 Vehicle_Type = input('Enter the Vehicle Type', 's'); switch lower(Vehicle_Type) case 'co...

21 dagen ago | 0

| accepted

Answered
Aligning numbers with text in a table
% 13 characters and aligned to the right: fprintf('%13s %13s %13s %13s \n', 'a', 'yes','async','asychronous'); % 13 characters...

21 dagen ago | 1

| accepted

Answered
not enough input arguments( not what you think)
"its says x=x0 in line 6 but this specific data is not in line 6" This means, that you do not call the function you think you a...

21 dagen ago | 0

Answered
What changes are needed to run the code
ODE = @(x,y) [ ... y(2); ... y(3); ... (A.*(y(2)+0.5*x*y(3)) - y(1)*y(3) + y(2)*( y(2)+M^2*(sin(Psi))^2) - L1*y(4...

21 dagen ago | 0

Answered
image encryption using rc4 : error in bitxor
You instruct PRGA to reply 128 values: Cipher = uint8(PRGA(KSA(key), size(original,2))); I assume you want: Cipher = uint8(PR...

21 dagen ago | 0

| accepted

Answered
Modify drawnow limitrate to update only 10 frames per second.
figure; axes('NextPlot', 'add'); tic; while 1 plot(rand, rand) if toc > 0.1 drawnow; tic; end end ...

21 dagen ago | 0

| accepted

Answered
How to generate images of binary random speckle patterns
This topic is discussed frequently here: https://www.mathworks.com/matlabcentral/answers/?term=tag%3A%22circle+packing%22

21 dagen ago | 0

Answered
I am getting error says parse error
I guess, that the line before is the problem: options = Remember to append a ... as line continuation. This is no valid Matla...

22 dagen ago | 0

Answered
How can I change the order of an N-dimensional array?
X = permute(X, [3,1,2,4]);

22 dagen ago | 0

| accepted

Load more