フィルターのクリア

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.
  1 件のコメント
Pablo Rodriguez
Pablo Rodriguez 2016 年 10 月 3 日
You could use cell arrays:
A = zeros(720,360);
B = zeros(360,360);
Matrix={A,B};
Let me know if it helps you :)

サインインしてコメントする。

回答 (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