필터 지우기
필터 지우기

How can i repeatedly store a smaller matrices after manipulations in a specific place of a larger matrix.

조회 수: 2 (최근 30일)
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.

답변 (2개)

Fabio Freschi
Fabio Freschi 2016년 10월 3일
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)];
  댓글 수: 1
sibusiso Motsa
sibusiso Motsa 2016년 10월 3일
Maybe my example was wrong. i have an image say(720x720) and i created a matrix A which is the same size to that of the image, what i am doing is B= subtract even columns from odd column and also C= subtract even rows from odd rows from the resultant matrix of the first operation(matrix B) and store these results at specific locations of the matrix A.

댓글을 달려면 로그인하십시오.


Joe Yeh
Joe Yeh 2016년 10월 3일
편집: Joe Yeh 2016년 10월 3일
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
sibusiso Motsa
sibusiso Motsa 2016년 10월 4일
The picture depicts what i want to achieve, having a 720x720 image for example and obtain matrix A through column subtraction(odd-even) of the original image, matrix A1 obtained from row subtraction(odd-even) of mtrix A. matrix B obtained from column sub of A1, matrix B1 from row sub of B.repeating this process for a number of iteration.but my problem is storing these manipulations in one matrix which is the size of the original image/matrix

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by