Answered
How to read a single precision binary data file in to MATLAB?
The posted file has 198'618'806 bytes. This is not a multiple of 4, so it cannot contain only float values. I guess, that you a...

3 years ago | 0

Answered
from 1D vector to mesh plot
% The grid: x = linspace(-3, 3, 50); y = linspace(-3, 3, 50); R = sqrt(x.^2 + (y.').^2); % The concentration: Cx = linspa...

3 years ago | 1

| accepted

Answered
How to create a loop with unknown number of iterations?
ready = false; k = 1; while ~ready mask = z_input < fin & z_input >= (fin - k); if any(mask) ready = tr...

3 years ago | 0

| accepted

Answered
how to change datetime cell to matrix array
TT = cat(1, T{:})

3 years ago | 1

| accepted

Answered
I would like help setting up my code
up1 = strfind(con.', ones(1, 100)); up2 = strfind(con.', zeros(1, 80)); up = intersect(up1, up2 - 21); Cleanup detections wi...

3 years ago | 0

Answered
Why is the MATLAB's Generalized Laguerre function significantly slower than that of scipy-python
It seems to be a symbolic computation in the Matlab implementation. With a numerical solution the function is much faster: tic;...

3 years ago | 2

| accepted

Answered
Get min from group(s) of data within an array
Is the 4th row a counter for each day? Then this can be used: (By the way, please post input data in a form, in which they can ...

3 years ago | 1

Answered
How to apply or operator on the components of a vector?
any(v) % If n is not the number of elements: any(v(1:n))

3 years ago | 0

| accepted

Answered
modify anonymous function using eval
Use a function instead: function y = fun1(x, p1, p2, p3) if nargin == 1 p1 = 1; p2 = 1; p3 = 2; end y = x*p1...

3 years ago | 0

Answered
Can't figure out how to fix endless while loop
k = 1; Output = zeros(size(To_3)); % Pre-allocation while abs(Po_5 - Po_8) > 100 Po_8 = Po_2 * Prf; To_8 = To_2 * (...

3 years ago | 0

Answered
flushing the keyboard input after a pause.
The command window does not offer a way to flush the input buffer. But this window is a bad way to implement a user interface, i...

3 years ago | 2

Answered
How to sort a complex vector with tie breaker angles between [0, 2π)?
Maybe it helps to sort the rotated values: a = [2, -1, i, -i]; [~, idx] = sort(-a * 1i); a(idx)

3 years ago | 0

Answered
error "Undefined function 'sumabs' for input arguments of type 'double'. Error in Gauss_Seidel (line 63) h=sumabs(A(i,:))-abs(A(i,i));""
% h = sumabs(A(j,:))-abs(A(j,i)); h = sum(abs(A(j,:))) - abs(A(j,i));

3 years ago | 0

Answered
How to check if two planes intersect with each other?
Planes intersect, if their normal vectors point to different directions: A = [-1140,14,16.125; -1140,14,0; -1140,10.5,-4; 1118,...

3 years ago | 0

Answered
Mean distance function upgrade question
data = table2array(readtable("test.xlsx")); % group1 = length(data(~isnan(data(:,1)))); Faster: group1 = nnz(~isnan(data(:,1)...

3 years ago | 0

Answered
How would I use the 'count' function but to only count instances of both columns being specified?
x = [1 4; 5 3;9 8; 2 7;1 8;7 2; 2 7;1 5;4 3]; n = sum(all(x == [2, 7], 2)) % Alternative: nnz() instead of sum() If the value...

3 years ago | 0

| accepted

Answered
convert matrix of cells into matrix of vectors
There are different method to concatenate the matrices to the wanted output. One is: X = cat(1, A1{:}); X = reshape(X, 1024, 6...

3 years ago | 0

Answered
plot many channels with same x axis and repeated y axis values
X = rand(20, 200); % Some test data XX = X + (0:19).'; % Shift vertically plot(1:200, XX)

3 years ago | 1

| accepted

Answered
Extract values from a double list
Maybe the 2nd question means: C = {'A', 'B4', 'G6', 'D5'}; D = strjoin(C, ' -> ') Use the online tutorial Kalyan has suggeste...

3 years ago | 0

| accepted

Answered
need plot a graph using Euler's method for both numerical and analytical
h = 10; % step size x = 0:h:60; % the range of x y = zeros(size(x)); % allocate the result y y(1) = 2; % the initial y va...

3 years ago | 1

Answered
Clicking app button moves app behind Matlab's main window.
This was discussed here: https://www.mathworks.com/matlabcentral/answers/296305-appdesigner-window-ends-up-in-background-after-u...

3 years ago | 0

Answered
Unrecognized function or variable 'extractDescrAppearance'. error
Neither extractDescrAppearance nor extractDescrGradient is a known Matlab command. Searching in the net does not find a match. S...

3 years ago | 0

Answered
Non linear Newton iteration method
Similar to your other question, [F1,F2,F3] is not a function handle, but a vector. Here you call F1, F2 and F3 without inputs. ...

3 years ago | 0

Answered
Can i pass an array of n strings to a function that takes n strings as input?
nameArray=[1,n] This creates an [1 x 2] vector. The 1st element is 1, the second is n. Inside the loop you do not work with s...

3 years ago | 0

Answered
Error using patch not enough input arguments
Omit all parts of the command, which are not mandatory: patch([x fliplr(x)], [yMean-ySEM fliplr(yMean+ySEM)]) Now compare this...

3 years ago | 0

Answered
Array indices must be positive integers or logical values
I guess boldly, that this line is failing: X = X0 - J(X0)\F(X0); J and F are defined as vectors, not as functions. I've remo...

3 years ago | 2

| accepted

Answered
how to modify a file. txt
C = readlines('YourFile.txt'); idx = find(contains(C, 'TheWordYouAreSearching'), 1); writelines(C(1:idx), 'Output.txt'); % [E...

3 years ago | 0

| accepted

Answered
Why has the locale changed in R2022a?
I find this in the release notes of R2022a: External Language Interfaces MEX Functions: UTF-8 system encoding on Windows platf...

3 years ago | 2

| accepted

Answered
How do i check if elements from my rows of vector are within range of one another
With some bold guessing of what you want to achieve: X = [ 0.2734, 0.1734; ... -0.1671, -0.2671; ... 0.0753, 0.0...

3 years ago | 0

| accepted

Answered
How to concatenate columns of varying lengths, generated by a for loop, into a matrix?
Maybe all you need is: Node_CONC = nan(200000,num_sim); THETA_ObsNode = nan(200000,num_sim); FLUX_ObsNode = nan(200000,n...

3 years ago | 0

| accepted

Load more