필터 지우기
필터 지우기

Info

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

explaining this code for matrix

조회 수: 2 (최근 30일)
goran
goran 2014년 1월 20일
마감: MATLAB Answer Bot 2021년 8월 20일
anybody explain me this code
if true
A = randi(15,3)
B=A;
B(tril(B)>0)=nan;
C=B(~isnan(B));
[a,b] = unique(C,'first');
[~,ii] = sort(b);
c = histc(C,a);
out0 = [a(ii),c(ii)];
out = out0(find(out0(:,2)>1,1,'first'),1);
if isempty(out), disp('no duplicates'); end
end
end

답변 (1개)

Bruno Pop-Stefanov
Bruno Pop-Stefanov 2014년 1월 20일
편집: Bruno Pop-Stefanov 2014년 1월 20일
I suggest you set a breakpoint at the beginning of the code to use the debugger. Using the debugger you can execute each line at a time and observe the values of each variable.
To set a breakpoint, click on the left next to a line number, and a red dot will appear. Hit F5 to run the code, and then press F10 to step from one line to another. In the Workspace window you can see the value of each variable during execution. Look up the functions you don't know in the MATLAB documentation or execute
help <function>
in the Command Window. For example, for help on the tril function, execute:
help tril
Good luck!
  댓글 수: 2
goran
goran 2014년 1월 20일
how activate workspace window in editor that i see values of variables?
Bruno Pop-Stefanov
Bruno Pop-Stefanov 2014년 1월 20일
Execute workspace in the Command Window. You can also type the name of a variable in the Command Window and its content will be displayed.

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

Community Treasure Hunt

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

Start Hunting!

Translated by