필터 지우기
필터 지우기

Storing error values in for loop

조회 수: 3 (최근 30일)
Griffin Polglaze
Griffin Polglaze 2020년 4월 28일
답변: Rik 2020년 4월 28일
I'm sure this is a pretty simple for loop but I'm trying to store the error value for each iteration performed in my code but not too sure how to do this. The error is equal to this. Any suggestions are greatly appreciated. Thanks
error = max(abs(T - T_c), [], 'all');

답변 (1개)

Rik
Rik 2020년 4월 28일
Don't use error as a variable name. Otherwise you can just use indexing:
err=zeros(1,N);
for n=1:N
%your code goes here
err_for_this_iteration=rand;
err(n)=err_for_this_iteration;
end

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by