Beantwortet
Changing the range of for loop give different result
You cannot create a matrix, whose elements are matrices. This works with a cell array: A = cell(r+1, k+1); for i = 2:r+1 ...

fast 5 Jahre vor | 0

Beantwortet
Matlab如何将cell中的矩阵进行合并?
R = {[3;2], [3;5], [4;2], [4;5], [5;2]}; nR = numel(R); f = true(1, nR); for iR = 1:nR if f(iR) ...

fast 5 Jahre vor | 1

Beantwortet
separate strings that are inside a cell
Your description is not clear yet. I dare to guess: % Input (thanks Adam): C = {"sdfsd"; "dare"; ["abs";"ses"]; "erwe"; "serwe...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
error using "fread"
cd('E:/image_trans/Emis32_%d.bin'); This does not look like a valid folder name. Is there really a % character? Later on this i...

fast 5 Jahre vor | 0

Beantwortet
Group values of a vector into new vectors according to magnitude
A = [17 323 100 3 278 220 45 351 212 51]; Y = discretize(A, [0, 50, 100, 360]) C = splitapply(@(x) {x}, A, Y)

fast 5 Jahre vor | 1

Beantwortet
How to convert to a parallel program?
Pre-allocation is essential. Do not let array grow iteratively, but create them with the final size: n = 41; h = 1 / (n...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
How to select every 54th image in the folder?
A = 'D:\Your\A'; B = 'D:\Your\B'; AList = dir(fullfile(A, 'a*.jpg')); BList = dir(fullfile(B, 'b*.jpg')); nB = numel(BLis...

fast 5 Jahre vor | 1

Beantwortet
Multiply cell by cell
Use a loop: for k = 1:numel(C_inside2) C_inside2{k} = C_inside2{k} .^ 2; end This is faster than cellfun: C_inside2 = ce...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
How can I speed up (or avoid) a comparison in for loop?
What about omitting the loop: A(ismember(L, f)) = true; Or: LUT = [false, N < threshold]; A(LUT(L + 1)) = true;

fast 5 Jahre vor | 1

| akzeptiert

Beantwortet
downsample data adapively/"intelligently"
This is not a trivial problem. In the general case it is a global optimization problem and there can be a huge number of equival...

fast 5 Jahre vor | 2

| akzeptiert

Beantwortet
Speed Up the for loop
Fmt1 = '%6.2f \t %6.4f \t %6.4f\t %6.2f \t %6.2f \t %6.2f \t %6.2f'; Fmt2 = '%s \t %6.2f \t %6.2f \t %6.2f \t %6.2f \t %6.4f \t...

fast 5 Jahre vor | 1

| akzeptiert

Beantwortet
Error while recording using audio recorder object
record_file=getaudiodata(recorder); ffname = sprintf('%s%s',record_file); getaudiodata replies a numerical array with the sign...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
What should go in a next-generation MATLAB X?
A complete list of changes for each command. Currently we find "introduced in Rxy" already, but modifications of inputs and out...

fast 5 Jahre vor | 8

Beantwortet
Avoid ode15s from freezing in parameter optimization
I've limite the time to [0, 15]. You see that one component explodes between t=15 and t=16. This let the step size of the integr...

fast 5 Jahre vor | 0

Beantwortet
How increase calculate speed in for loop
Start with a simplification of the code: Depth = 5000; Num_Alines = 400; Num_Bscan = 300; Alines = 180 h ...

fast 5 Jahre vor | 0

Beantwortet
How to add integers without correction?
a = int8(126); b = int8(2); tic for k = 1:1e4 c = bitadd1(a, b); end toc tic for k = 1:1e4 c = bitadd2(a, b);...

fast 5 Jahre vor | 1

| akzeptiert

Beantwortet
Solving a System of ODEs using Euler's method
Your function to be integrated depends on t also. You call this x in the Euler method. At is easier to use vector equations: f...

fast 5 Jahre vor | 0

Beantwortet
Matlab versions supported on Windows 11?
Windows 11 have not been officially released yet. We and MathWorks cannot know how the final version will work. There have been ...

fast 5 Jahre vor | 0

Beantwortet
How to Copy Upper diagonal elements of matrix A into a new matrix.
A = [1 2 3 4; 2 1 3 4; 1 1 1 2; 1 0 0 1]; B = triu(A)

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
why are some integrals not solvable in matlab?
Is it a numeric or symbolic integration? Most functions do not have a closed form integral. This is a mathematical limitation. ...

fast 5 Jahre vor | 0

Beantwortet
Diagonals in Matrices Matlab
I'm not sure if I can follow your explanations. A short example might be useful. The term "be -.25 for every 2 instances" might...

fast 5 Jahre vor | 1

| akzeptiert

Beantwortet
I have 2011a on my machine. I installed 2014a. it is always running MATLAB2014a, how to select MATLAB2011 for running please?
How do you start Matlab? The exact method to start a specific Matlab version depend on the operating system. But the way is to i...

fast 5 Jahre vor | 0

Beantwortet
Trying to use a for loop to calculate years with an IF statement but it seems to ignore it.
Either for M = 2:300 if balance(M) >= 50000 %balance(M) break; % Leave the for M loop end % NOPE ! M =...

fast 5 Jahre vor | 0

Beantwortet
How to plot a smooth curve with only a few points?
Either decide for a linear interpolation: x = 1:6; y = rand(1, 6); plot(x, y, 'ko'); hold on xx = linspace(1, 6, 100); ...

fast 5 Jahre vor | 1

| akzeptiert

Beantwortet
Is rsqrt the same as Fast inverse square root?
i = * ( long * ) &y This is equivalent to: y = single(pi); i = typecast(y, 'int32'); The shown code of Q_rsqrt is an ap...

fast 5 Jahre vor | 0

Beantwortet
I am getting Undefined function or variable 'A', error in Untitled line 95
The variable A should be polulated in this line: A(rr,:,z) = [sod,rangeL1,rangeL2]; If A in undefined, this line was not c...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
ODE45 is taking hours and hours to compute
Symbolic omputations need a lot of time. Can you implement the code numerically? If the equation to be integrated is stiff, ODE...

fast 5 Jahre vor | 0

Beantwortet
semilogy, loglog do not work in order to set the y axis on a logarithmic scale
After figure, hold on the YScale is determined already. Define it explicitly instead and you plot(): figure axes('yscale', 'lo...

fast 5 Jahre vor | 0

| akzeptiert

Beantwortet
About 3 significant digit?
fprintf('%.3g\n', pi) fprintf('%.3g\n', pi * 1e6) fprintf('%.3g\n', pi * 1e-6)

fast 5 Jahre vor | 0

Beantwortet
"Too many output arguments" error while working with the fmincon solver inside the optimization tool.
A bold guess: [solution,objectiveValue] = fmincon(@objectiveFcn,w,[],[],[],[],[],[],... @objectiveFcn,options2); % ^^^^...

fast 5 Jahre vor | 0

| akzeptiert

Mehr laden