Answered
find the equal values that stand together on the same row or column or diagonal in the matrix
Maybe you mean: pool = [-1, 1, 2]; index = randi([1, 3], 15, 15); data = pool(index); match = conv2(data > 0, ones(3, 3)...

4 years ago | 1

Answered
Index in position 2 exceeds array bounds (must not exceed 1).
dx1dt = x4 .* cos(x5) .* cos(u3); % Now dx1dt is a scalar ... x(1,i) = x(1,i-1) + h * dx1dt(1,i-1); % This treats dx1dt ...

4 years ago | 0

| accepted

Answered
Storing values from a for loop
B = 1000; R2 = zeros(1, B); % Pre-allocation for iter = 1:B ... R2(iter) = 1 - sse / sst; end A problem is, that R...

4 years ago | 0

Answered
Newton's method - problems in calculating alpha value
In the lines: func = @(x) eps * c_s * x^4 + (alpha_k + 1/(s1/lamda1+s2/lamda2)) * x - ... ((1/(s1/lamda1+s2/lamda2...

4 years ago | 0

| accepted

Answered
how to declear global "import java.awt.Robot" and "import java.awt.event.*"?
If such a global import is possible, it might destroy Matlab's stability. The imported functions without wildcards have a higher...

4 years ago | 0

Answered
Performance of log() is wildly different in two different contexts and machines for same data?
Summary: On the 16 GB M1 MacBook, the lines tic tdg_log = log(tdg); toc displays, that the processing needs 1.5 seconds. U...

4 years ago | 0

Answered
Numerical integration of discrete data using higher precision
You explain, that you have discrete data, but the code you show uses a function. If the data are given in double precision, usin...

4 years ago | 0

Answered
Passing multiple Arrays to loop a Function and creating a 1 column array
The code contains some strange details: A = ArrayA; (1,000x1) Double Please use the standard notation. I assume this would be ...

4 years ago | 0

Answered
Unable to perform assignment because the indices on the left side are not compatible with the size of the right side.
Let Matlab stop at the error using the debugger: dbstop if error Then run the code again. If it stops, chek the sizes of the u...

4 years ago | 0

Answered
how do I put waitbar inside a figure (Matlab 2016a)?
You find a lot of examples in the FileExange. Search there for "porgressbar": https://www.mathworks.com/matlabcentral/fileexcha...

4 years ago | 0

| accepted

Answered
Calculationg with quternions Matlab function did not work
function p_A = q_transform_coordinate_vector(R_A_B, p_B) % ^^^^^ p_A = q_A_B * q_pu...

4 years ago | 1

| accepted

Answered
Error using reshape: Size arguments must be real integers. Except all values are positive whole numbers?
Change: raw_data.variable_mat = raw_data.variable_mat(:,1:reshape_val); to raw_data.variable_mat = raw_data.variable_mat(:,1:...

4 years ago | 1

| accepted

Answered
How to solve this error: =: nonconformant arguments (op1 is 1x1, op2 is 100x1)?
T = linspace(0, 10)'; % Time f = 0.1; % Frequency Am = 10; % Phase F = Am*sin(2*pi*f*T); % Sin wave input Now F is a [100, ...

4 years ago | 0

Answered
Can I hit the "OK" button on inputdlg through coding?
See this example for creating your own dialog with a timer: https://www.mathworks.com/matlabcentral/fileexchange/24871-autowarnd...

4 years ago | 0

Answered
Interpolation method of IMAGE
x = zeros(640, 480, 3); x(:, 1:2:end, :) = 1; image(x) This looks confusing to me in the online version: Where are the steps ...

4 years ago | 0

Answered
MEX-file efficiency with multiple file-pass function calls in .m script
Do you use the terms "function" and "script" correctly? Functions and scripts are stored in .m-files. Functions start with the ...

4 years ago | 0

Question


Submit button not working sometimes
A few weeks ago the Submit button in this forum stopped to work for me in about 50% of the cases. Then I copy my answer or comme...

4 years ago | 2 answers | 3

2

answers

Answered
Linear indexing in 3D matrix
Look into the code of sub2ind. It is easy to create an inline version of what you want: s = [2, 3, 4]; x = reshape(1:prod(s), ...

4 years ago | 0

Answered
I am facing problem regarding storage of values for d() using for loop which is of 100x100 size for each iteration of a and k.
You overwrite the data by zeros repeatedly: for t=1:L for v=1:elements for w=1:elements % Here all f...

4 years ago | 0

Answered
removing zeros from matrix
x(x==0) = []; % Or: x = x(x~=0); Where do the zeros come from? Instead of removing them it might be easier to avoid to crea...

4 years ago | 0

Answered
Trisurf : How to interactively change the plot opacity?
GUIs are not hard to control. function testGUI % Some test data: [x,y] = meshgrid(1:15, 1:15); tri = delaunay(x,y); z = pea...

4 years ago | 0

Answered
How to take output from one program as input in the same?
Of course this is possible. A trivial example: function main [a, b] = thePoints; alpha = theAngle(a, b); disp(alpha) end ...

4 years ago | 2

| accepted

Answered
How to center a cloud of data points (x,y,z) to coordinate origin in 3-D space?
I'm not sure, what "center each marker" means. But I assume you want to subtract the mean value: trajectory = [167.282166 37...

4 years ago | 0

| accepted

Answered
solve an ode with three methods in the same script
Each function has its own workspace. The results of the called scripts are stored in the workspace of the function mainfunctionm...

4 years ago | 0

Answered
If it is possible to display matlab's command window in app designer's text area?
See: FEX: CmdWinTool cmdWinDoc = com.mathworks.mde.cmdwin.CmdWinDocument.getInstance; initial = cmdWinDoc.getLength; % Ru...

4 years ago | 1

Answered
Split cell each 13 characters
It would be usful, if you post your input data and the wanted output. Currently I find the information matrix of about 32x1 ea...

4 years ago | 0

Answered
Reverse of find groups
Use the 2nd output of findgroups: A = [1,1; 1,2; 2,2; 3,3; 3,4; 1,3; 1,2]; [G, ID1, ID2] = findgroups(A(:, 1), A(:, 2)); AG =...

4 years ago | 0

Answered
Discrepancies between single and double precision sum over time
This is the expected behaviour. Remember that the sum is an instable numerical operation. d = zeros(1,1e7); s = zeros(1, 1e7, ...

4 years ago | 0

| accepted

Answered
not able to solve the integration function
This cannot work: x(j) = linspace(0,0.025,101); On the left is a scalar and on the right a vector with 101 elements. Seeing o...

4 years ago | 0

Answered
How to work with Struct With Struct construction
It is not clear, how the inputs data exactly look and what you want as output. Prefer to post some code, which produces both. M...

4 years ago | 1

| accepted

Load more