How can i repeatedly store a smaller matrices after manipulations in a specific place of a larger matrix.
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
i am trying to store smaller matrices in a larger matrix. e.g i have an empty large matrix(720 x 720),in it i'd like to store a (720 x 360) and (360 x 360) matrix. i want them to occupy positions starting from 0,0 to X=360,Y=720 and from (361,0) to X=720,Y=360 respectively.
1 commentaire
Pablo Rodriguez
le 3 Oct 2016
You could use cell arrays:
A = zeros(720,360);
B = zeros(360,360);
Matrix={A,B};
Let me know if it helps you :)
Réponses (2)
Fabio Freschi
le 3 Oct 2016
I think your first matrix should be 360x720 (and indexing starts with 1). Try this
% create the matrices
A = rand(360,720);
B = rand(360);
% fill the original matrix
M = [A; B zeros(360)];
Joe Yeh
le 3 Oct 2016
Modifié(e) : Joe Yeh
le 3 Oct 2016
Here's a solution (apparently this will only work with a square matrix) :
im_result = zeros(size(im_original));
% Subtract even columns from odd columns and store in the first half of the result matrix
im_result(:, 1 : end/2) = im_original(:, 1:2:end) - im_original(:, 2:2:end);
% Subtract even rows from odd rows and store in the second half of the result matrix
im_result(:, end/2+1 : end) = (im_original(1:2:end, :) - im_original(2:2:end, :)).';
3 commentaires
Voir également
Catégories
En savoir plus sur Matrix Indexing dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!