could anyone help me how to solve the issue in the following code

조회 수: 4 (최근 30일)
jaah navi
jaah navi 2019년 7월 25일
답변: per isakson 2019년 7월 25일
code:
unused_rows1=1:12;
while ~isempty(unused_rows1)
rows1_matrix=reshape(unused_rows1,[],2);
rows1_matrix(:,end)=rows1_matrix(end:-1:1,end);
for k=1:size(rows1_matrix,1)
rows1=rows1_matrix(k,:)
y=diff(rows1)
unused_rows1=[];
end
end
z=max(y)
in this code i want to find the maximum of y.when i run the code i am getting 6 different values for y.
Among the 6 values i want to maximum value.Could anyone please help me on this.

채택된 답변

KSSV
KSSV 2019년 7월 25일
unused_rows1=1:12;
while ~isempty(unused_rows1)
rows1_matrix=reshape(unused_rows1,[],2);
rows1_matrix(:,end)=rows1_matrix(end:-1:1,end);
for k=1:size(rows1_matrix,1)
rows1=rows1_matrix(k,:)
y=diff(rows1)
y_max = max(y) ;
unused_rows1=[];
end
end
z=max(y)

추가 답변 (1개)

per isakson
per isakson 2019년 7월 25일
Replace
y=diff(rows1)
by
y(k)=diff(rows1)

카테고리

Help CenterFile Exchange에서 Neuroimaging에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by