All Questions
4,421 questions
0
votes
0
answers
44
views
Find the page in a 3D matrix that is closest to a given matrix
One can easily concatenate (stack up) four arrays by using:
B = cat(3, A, A, A, A); % here A is 2-dimensional M x N matrix and B is 3-dimensional M x N x 4 stack
How is it possible to concatenate (...
8
votes
4
answers
137
views
How to divide a matrix in MATLAB into N^2 segments each with NxN elements?
Assuming we have a matrix M of size N^2 x N^2 elements (e.g., 9x9), what's the fastest way to split it into say 3x3 segments (each with 3x3 elements).
One way that comes to mind is the following:
M = ...
0
votes
1
answer
39
views
how to operate on a Matlab vector A with a condition from vector B and a condition from the values of vector A
I have two vectors. One with time information and one with channel information.
For example, A has time values
A = 1, 2.5, 2.7, 3, 4, 5, 6, 7, 8, 9, 10
and B has channel values
B = 1, 1, 2, 2, 2, 1, 2,...
1
vote
1
answer
22
views
Filtering data by matching values in Matlab
I have 2 data sets in Matlab, each one is a 2xn array of data, where the top row contains timestamps. However, not each timestamp has a data point. Now I want to compare these datapoints, but I cannot ...
0
votes
1
answer
61
views
Is there an aggregate array function in Matlab? And is it possible to reference different index in such array function?
Is there an aggregate array function in Matlab similar to reduce in Google Sheet or foldr in Racket?
For example, the other day, I was hoping to extract/exclude a row representing every third week of ...
0
votes
1
answer
77
views
How can I make the mean of 3d matrices in a cell in Matlab?
I have a 1x12 cell in Matlab and each element of this cell has a 3d matrix. I want to make the mean of these 3d matrices, so that I obtain a 3d matrix that has the same dimensions of each one of the ...
0
votes
1
answer
41
views
How to assign values from vector to matrix in Matlab
Suppose we have matrix of indices A=[1,3;2,1] and array/cell array/struct/table of values
B=[10,20,30] or B=[10;20;30]
C={'aa';5;"g"}
D is 3x1 or 1x3 struct array with fields: values and D(...
0
votes
1
answer
104
views
Confusions regarding empty matrix in MATLAB?
I am trying to implement a code in a MATLAB and system is pure/ideal integrator and system has no zero
I have two confusions,
1)Why i am getting two different types of output for an empty matrix?
...
1
vote
1
answer
47
views
Better way to keep dimensions using reshape from struct array in matlab
I am wondering what is the best way to extract the data from an structured array in matlab and keeping is dimensionality if I use reshape while processing it.
Let's say I have the following struct ...
0
votes
1
answer
65
views
MATLAB variable appears to change size on every loop iteration when final size in unknow
I am coding in MATLAB.
I encountered this warning: "Variable appears to change size on every loop iteration".
Unfortunately, I cannot know in advance the size of that variable, so I cannot ...
2
votes
0
answers
57
views
Completely deleting elements from Matlab R2020b cell array [duplicate]
I have a Matlab R2020b cell array with <missing> values:
my_array =
6×1 cell array
{'a' }
{'b' }
{'c' }
{'d' }
{1×1 missing}
{1×1 missing}
...
2
votes
2
answers
102
views
List of decimal numbers to strings in MATLAB
I am trying to create a list of numbers of the form 1.X where X goes from 1 to 65 in order.
1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 1.10, 1.11, ..., 1.62, 1.63, 1.64, 1.65
I have tried the ...
3
votes
1
answer
71
views
Alternative to find(ismember) to find the position indices in an array
I'm having trouble to modify my code in an efficient way. I have a table of indices, say
table_of_indices=[1,2; 2,3; 3,1; 1,3; 11,8];
and take some specific elements in that table
E=[1,3;1,2];
...
0
votes
1
answer
44
views
Adams Fourth-Order Predictor-Corrector in MATLAB
I have attempted to implement the algorithm given in my 'Numerical Analysis' textbook (Burden and Faire, 9th edition, page 311.)
I am having trouble with the array index. Arrays are used to store ...
2
votes
1
answer
74
views
Matlab: Problem with logical indexing (combining two vectors with different sample rate)
I have in Matlab two time signals y1(t1) and y2(t2), see 1st diagram. The sample rate of t1 and t2 is different (t2 has a lower sample rate).
Goal: I want to mask y1 based on the value of y2: When y2 ...