Answered
Moving mean in matrix using first column
a = [1 3 5 2 4 6 7 8 10; 4 3 5 2 8 6 7 8 7; 5 8 9 7 2 3 6 1 5]; res=@(z) reshape(z,3,1,[]); A=arrayfun( @(i) ...

4 years ago | 0

| accepted

Answered
How to calculate the moving average of a finite duration data using sliding concept?
Both are wrong. X = [2 3 4 5 6 8]; win=ones(1,4)/4; Y = conv(X,win,'full')

4 years ago | 1

| accepted

Answered
How to multiply a subset of matrix by a column from another matrix?
B = pagemtimes( reshape(A,128,257,[]) , reshape(y,257,1,[]) ) ; B=squeeze(B);

4 years ago | 0

| accepted

Answered
Transpose multiple columns to one row
num_sheets = 41; C = cell(1,num_sheets); for i = 3:num_sheets C{i} = readmatrix('filename',i ,Range="O2:O57").'; end ...

4 years ago | 1

Answered
Defining objective function using nested functions (Genetic Algorithm Solver)
I suspect that the r and x are both in fact 36x36 matrices while a is a 36x1 vector. If so, then, the correct implementation is,...

4 years ago | 0

| accepted

Answered
How to deal with CELL2MAT does not support cell arrays containing cell arrays or objects?
A=num2cell(num2cell(eye(3)),1) cell2matRecursive(A) function B=cell2matRecursive(B) if ~iscell(B{1}) B=cell2mat(...

4 years ago | 0

| accepted

Answered
Calling a automatically generated vector valued function handle with a vector
Because the original symbolic function is defined only on R^1, you must post-vectorize the matlabFunction output. syms x f = [...

4 years ago | 0

Answered
How can I reshape a square matrix to a rectangular matrix based on its adjacency list?
A=[ 0 -1 0 0 0 0 -2 -2 0 0 0 0 0 2 -1 0 0 0 0 0 0...

4 years ago | 1

| accepted

Answered
vector notation with data from struct array
Error in DMD_Prediction (line 42) P = [0 diff(E)/t_delta]; In all likelihood diff(E) is not a row vector. THat sho...

4 years ago | 0

| accepted

Answered
Create a random matrix with small gradient
A=rescale(rand(5),0,0.1);

4 years ago | 0

Answered
How can I decide one struct to another one?
%structfun(@(a,b) a./b, s1,s2,'uni',0) %EDIT: s3=s1; for fld=fieldnames(s1)' fld=fld{1}; s3.(fld)=s1.(fld)/...

4 years ago | 0

| accepted

Answered
Straight line approximation of elements in array
s=[0 NaN 5 NaN 0 NaN 0 NaN 5 NaN 0 NaN 0 NaN 5 NaN 0 NaN 0 NaN 5]; fillmissing(s,'linear')

4 years ago | 0

| accepted

Answered
Avoiding NaN Values When Using a Loop
entropy=-cumsum(pmf.*log2(pmf),'omitnan'); fprintf('Entropy Val %d: %f.20 \n', l:numel(entropy), entropy)

4 years ago | 0

| accepted

Answered
How can I split one large matrix to struct with several fields?
M=rand(100,20); Mcell=num2cell(permute(reshape(M,[10,10,20]),[1,3,2]),[1,2]); cell2struct(Mcell, "f"+(1:10),3)

4 years ago | 0

| accepted

Answered
Replace certain Values within a Matrix Based on Indices from Another matrix
[~,J,I]=find(gridsupplyidx); idx=sub2ind(size(gridsupply),I,J); gridsupply(idx)=5;

4 years ago | 1

| accepted

Answered
How can i sum my objective function with each iteration
sum(x.*r.*a,'all')

4 years ago | 0

| accepted

Answered
Is there a way to imregister some points on a matlab figure
If you have individual points as input to the registration, you should use fitgeotrans().

4 years ago | 0

Answered
Creating a matrix of different row sizes
gridsupply=sorted_dailygrid.*((1:24)<=ddailygridhours)';

4 years ago | 0

| accepted

Answered
Representation of matrix in term of sets
Simpler: d=diag(A); A(d==1,:)=0; [I,J]=find(A); k=[I,J]; I don't know what you mean by "set form". If you want each pai...

4 years ago | 0

| accepted

Answered
Can I have round corners with PATCH?
You can with polyshape, h=polybuffer( polyshape([7 7 5 5], [5 7 7 5]),0.5); plot(h,'FaceColor','r', 'FaceAlpha',0.5)

4 years ago | 0

| accepted

Answered
How to take the fft of a sum of exponentials?
If your exponentials span too many orders of magnitude, you will probably have numerical problems, but otherwise, this is how I ...

4 years ago | 1

Answered
How to solve this undefined problem?
I also have try adding n = p The error message says that p is undefined. Therefore, you should be doing p=n.

4 years ago | 0

Answered
Linear System Solve in MATLAB
So, I have n (let's say around 200) equations...I am worried if the sequential solve would be very slow when comapred against t...

4 years ago | 2

| accepted

Answered
Why do I get "no solution found" in fsolve while there is the actual value for them?
Your function is discontinous and non-differentiable (due to discontinuities in ala() and non-differentiabilities in abs(0), whi...

4 years ago | 1

Answered
Create help for method with arguments
function [m,s] = twoStats(x) % Test for help % %Arguments: % - x: Argument 1, the array to calculate statist...

4 years ago | 0

Answered
how to shift trapped zeros to the bottom keeping leading zeros in given matrix fixed?
A=[ 0 0 0 1 0 2 3 1 2 3 0 0 0 1 2 2 1 1 2 3 ...

4 years ago | 1

| accepted

Answered
How do I use a parfor loop to run multiple versions of the same program with varied parameters?
I am trying to run a MATLAB program which will run several versions of the same program at once with varied parameters For that...

4 years ago | 0

| accepted

Answered
How to save the last four iterations in a for-loop
One way: for i = 1:100 a(max(i-96,1)) = b + 4 ; end

4 years ago | 0

| accepted

Answered
How to find the corresponding value of an element in same row, but different column?
[elements,row]=unique(data(:,13)) element_timestamps=data(row,1)

4 years ago | 0

| accepted

Load more