필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

help with teachers code?

조회 수: 1 (최근 30일)
HUH
HUH 2013년 12월 2일
마감: MATLAB Answer Bot 2021년 8월 20일
I'm trying to evaluate my teachers code. Can anybody tell me what the line of x{ii}(:,1:(ii-1)) =minInt(:,1:(ii-1)) does?
for ii = 2:N+1 %Initializes the for loop. Takes the terms from 2 to the length of N+1. Will run the for loop for each value.
x{ii} = ones(N+1); %A statement of the for loop. Says that the cell array of x{ii} is a ones matrix of the size of N+1
x{ii}(:,1:(ii-1)) = minInt(:,1:(ii-1)); %This will take the current values of x{ii}, and in any row, column q
x{ii}(:,(ii+1):end) = minInt(:,(ii+1):end); %DO THIS LATER
P(ii) = det(x{ii});
%This sets P of the value of ii at the time to the determinate of x{ii} which is defined above.
end

답변 (2개)

sixwwwwww
sixwwwwww 2013년 12월 2일
x{ii}(:,1:(ii-1)) =minInt(:,1:(ii-1))
this line of code is accessing all rows values for columns 1 to ii-1 and then saving them in elememt 'ii' of cell array 'x' in the same matriix form. I hope it explains a bit

Image Analyst
Image Analyst 2013년 12월 2일
See the FAQ for a good explanation of cell arrays: http://matlab.wikia.com/wiki/FAQ#What_is_a_cell_array.3F

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by