Create a matrix from another one with an history window of 3 columns
1 回表示 (過去 30 日間)
古いコメントを表示
Could someone help me with my problem.
I've got an original 2 by 25 matrix and I want to create a new 2 by 25 matrix with the same columns than the original one. But I want them reorganized such that a given column (:,n) in the new matrix is different from the columns (:,n:n+2) of the original matrix.
I've struggled to do that as Ifind a way using loops that need a lot of if statement to control for special cases... Is there someone with a simple(r) method to do that?
4 件のコメント
回答 (1 件)
Stephane Dauvillier
2020 年 1 月 10 日
You can try the function diff:
A = magic(5);
B = diff(A,[],2)
But B will have n-1 column what do you want for the extra column ?
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!