フィルターのクリア

i want to create A 3-D matrix and i want a pixel to be increasing by 1 in each of the matrix. how can i do that

1 回表示 (過去 30 日間)
i want the 3rd row and 3rd column in each matrix to be increasing with every iteration. i hvave done this but it is not working. help, I am new to matlab
m=zeros(10,10,30); %define 3-D 10 by 10 by 30 matrix
n=30; %number of matrix
for k=1:n
t=0:1.0; %specify the value a pixel will take in each iteration
m(:,:,k)(3,3)=t; %the 3rd rown and 3rd column in each matrix will increase by t
display(m(:,:,k))
k=k+1;
t=t+0.1;
end

採用された回答

Geoff Hayes
Geoff Hayes 2018 年 7 月 13 日
Folakemi - the sytax
m(:,:,k)(3,3)=t;
is invalid. Do you really mean for t to be a 1x2 array with
t = 0:1.0;
or do you want it to be a 1x10 (or 10x1) array with elements evenly distributed from 0 to 1.0? If the latter, then try
t = linspace(0,1,10);
and do
t = linspace(0,1,10);
for k=1:n
m(3,:,k) = t;
m(:,3,k) = t';
end
If you want to increaser t for subsequent iterations, then you would need to do
t = linspace(0,1,10);
for k=1:n
m(3,:,k) = t;
m(:,3,k) = t';
t = t + 1;
end
  4 件のコメント
Geoff Hayes
Geoff Hayes 2018 年 7 月 13 日
編集済み: Geoff Hayes 2018 年 7 月 13 日
Perhaps this
t = 0;
for k=1:n
m(3,:3,k) = t;
t = t + 1/n;
end
or
t = linspace(0,1,n);
for k=1:n
m(3,3,k) = t(k);
end
Folakemi Omotoye
Folakemi Omotoye 2018 年 7 月 13 日
the second part worked. Thank you very much

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Type Identification についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by