필터 지우기
필터 지우기

MATLAB: Finding negative numbers and showing where they are

조회 수: 12 (최근 30일)
Thomas Mroczkowski
Thomas Mroczkowski 2020년 12월 10일
댓글: Walter Roberson 2020년 12월 10일
load Saturated_Table % load tables
load SpecificHeat_Data
SAT = SaturatedTable; % storing the tables as variables
SH = SpecificHeatData;
NNeg = SaturatedTable(1:end , 2:end); % Selects 1st rown to the end, 2nd colum to the end of the table
%mustBeNonnegative(NNeg) %states that the values above must be nonnegative
if NNeg<0
disp(neg)
end

채택된 답변

Walter Roberson
Walter Roberson 2020년 12월 10일
[row, column] = find(NNeg < 0)
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 12월 10일
while true
[row, column] = find(NNeg < 0, 1);
if isempty(row); break; end
newval = input( sprintf('Input non-negative for row %d column %d: ', row, columN);
if isnumeric(newval) && isscalar(newval)
NNeg(row, column) = newval;
end
end

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by