답변 있음
Problem in using mxSetPr with USHORT
Either use memcpy instead of copying the data in a loop. Or use mxSetData instead of mxSetPr, if you are really sure, that the ...

4년 초과 전 | 0

| 수락됨

답변 있음
Matlab doesn't show imaginary part of complex numbers for me!
Do you see the 2 trailing zeros? This looks like the "bank" format: format long g pi + 2i format bank pi + 2i Solution: Do ...

4년 초과 전 | 0

답변 있음
Runge-kutta results do not align with ODE45 solver, what am I doing wrong?
You are using wrong initial values in the Runge Kutta method: % X(:, 1) = RHS(0, V0); Nope! X(:, 1) = V0; The inital values ...

4년 초과 전 | 0

| 수락됨

답변 있음
Error when attempting to activate license - Host ID is not valid
Spaces? Is the 2nd character an uppercase o? Type it again: 20BE526B . I have troubles opening the page with my license current...

4년 초과 전 | 0

답변 있음
How to extract random subset of images from a cell array?
Of course randperm works with cell arrays: random_subset = im_(randperm(numel(im_), 100)); This selects 100 elements in random...

4년 초과 전 | 0

| 수락됨

답변 있음
getappdata / setappdata does not work for me?
After the line figImage = figure; the variable figImage contains the handle of the figure. If you want to use this handle in a...

4년 초과 전 | 0

| 수락됨

답변 있음
What is the equivalence startup fcn in Guide?
I assume you mean the CreateFcn.

4년 초과 전 | 0

| 수락됨

답변 있음
Undocumented startup option / Starting MATLAB GUI from Java
As far as I remember, starting Matlab with the Java VM was optional in Matlab 4 or 5. So you could enable the JVM manually. Ther...

4년 초과 전 | 1

답변 있음
Determining smoothness of a trajectory
You have to start with a mathematical definition of what you call "smooth". Do you mean differentiable? This cannot work. There...

4년 초과 전 | 0

답변 있음
Check the flipped of 3D Array matrix
Do you mean: isequal(A, flip(A, 2)) If A is huge (e.g. 1 GB), this operation is not efficient, because it duplicates the Array...

4년 초과 전 | 0

| 수락됨

답변 있음
matlab structure to csv file
% [EDITED] Adjusted for comma separators: coef.header = {'mexico', 'france', 'berlin', 'italy', 'china', 'srilanka'}; coef.da...

4년 초과 전 | 1

| 수락됨

답변 있음
How to fprintf a transposed matrix?
fprintf takes the argument elementwise as they are store in the memory. So: A = [7 11; 15 23; 9 7]; fprintf(' %d \t %d \t %d\n...

4년 초과 전 | 0

답변 있음
problem in plot while loop
k0 = 2 * pi / 0.6328 * 1e6; t2 = 1.5e-6; n1 = 1.512; n2 = 1.521; n3 = 4.1-1i*0.211; n4 = 1; m = 0; x = 1.512; t3 = 1e-...

4년 초과 전 | 0

| 수락됨

답변 있음
How to plot Multivariable ODE with conditions ?
You are asked to do this in Simulink, not in Matlab. In Matlab a numerical solution is a better idea than hoping, that there is...

4년 초과 전 | 1

| 수락됨

답변 있음
Is there any way to code this on a different way?
No. This is the efficient solution already. To get the 100.th most frequent element, you have to determine the frequencies of al...

4년 초과 전 | 0

| 수락됨

답변 있음
requirements to install Matlab, need compilers or tools
You can keep the old Matlab version. If you need a compiler depends on what you want to do with Matlab. For the Coder, compilin...

4년 초과 전 | 0

답변 있음
how can I modify a triple "for" cycle to run faster?
Of course you have to pre-allocate. ntables = 50; nlines = 10000; ncolumns = 30; B = zeros(ntables, nlines, ncolumns); f...

4년 초과 전 | 0

| 수락됨

답변 있음
How can I rearrange a vector?
Some bold guesses of what you want to achieve: aa = [9 8 7 6 5 4 3 2 1 0 1 2 3 4 5 6 7 8 9]; a = aa; a(a >= 5) = 0 a = a...

4년 초과 전 | 0

| 수락됨

답변 있음
How do I avoid the error message "Index exceeds the number of array elements" in a for loop?
day(1):day(3) is the vector 1:13. Some other simplifications, which uses a counter to access the days: folder = 'C:\Users\Do...

4년 초과 전 | 1

| 수락됨

답변 있음
How to vectorize the MATLAB code?
a = rand(1, 11); N = length(a); b = zeros(1,N - 1); for i = 1:N-1 b(i) = a(i) + a (i + 1); end % Vectorized 1: b2...

4년 초과 전 | 2

| 수락됨

답변 있음
Variable "H" might be set by a nonscalar operator
If H is an array, what is the meaning of: if H < 0.5 ? The IF command requires a scalar condition. Therefore Matlab inserts an...

4년 초과 전 | 0

답변 있음
Why has matlab become extremely inefficient with global variables?
You do not use global variables, but a script. Although you declare the varaibels as globals inside the script, there is no need...

4년 초과 전 | 0

답변 있음
Rotating coordinate system inside loop
a=4; b=4; ab=a*b; Input=zeros(ab,2); for ii=1:a Input((ii-1)*a+1:ii*a,1)=(a-b:-2:-(a+b)+2)'+2*(ii-1); Input((ii-...

4년 초과 전 | 0

| 수락됨

답변 있음
why am I getting "Array indices must be positive integers or logical values"
The variable Fs has the value 5. Then the expression: Fs(0:(L/2)) is treated as indices. 0 is not a valid index. In addition F...

4년 초과 전 | 0

답변 있음
Subtraction is not working in while loop
If you do not change the value of the variable used in the condition of the while loop, this loop must run infinitly: x = rand;...

4년 초과 전 | 0

답변 있음
Why do I receive an error with the save function?
save gets the name of the variable, nit the variable itself: save(matFile, 'mypadCBCTimage', '-append', '-nocompression'); % ...

4년 초과 전 | 0

| 수락됨

답변 있음
Problem using if statements in for loop
Welcome to the world of numerical maths. See: FAQ: Why is 0.3-0.2-0.1 not equal to zero? The standard example is: any((0:0.1:1...

4년 초과 전 | 0

답변 있음
Moving Average with timestep
A simple average over 2 elements (length of M can be even or odd): Len = numel(M); v = (M(1:2:Len - rem(Len, 2)) + M(2:2:Len...

4년 초과 전 | 0

| 수락됨

답변 있음
Assign nearest maximum value.
Why 30 and not 20? Both have a distance of 5. A = [10,20,30,40]; S = 25; [~, index] = min(abs(A - S)); A(index)

4년 초과 전 | 0

답변 있음
Why won't this ODE setup work?
Omit the "(t)" in the output: [ceSol, csSol, cesSol, cpSol]= dsolve(odes,conds);

4년 초과 전 | 0

더 보기