MATLAB: Finding negative numbers and showing where they are
20 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Thomas Mroczkowski
am 10 Dez. 2020
Kommentiert: Walter Roberson
am 10 Dez. 2020
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
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 10 Dez. 2020
[row, column] = find(NNeg < 0)
1 Kommentar
Walter Roberson
am 10 Dez. 2020
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
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!