condition on random generated data
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
abdul rehman
am 13 Jun. 2021
Bearbeitet: Adam Danz
am 14 Jun. 2021
abc_data = rand((randi(20)),2)
on the above random data, I want to put a condition that if row value 1 > 0.5 and column value 1> 0.6 than print true else false
0 Kommentare
Akzeptierte Antwort
Adam Danz
am 13 Jun. 2021
Bearbeitet: Adam Danz
am 14 Jun. 2021
> if row value 1 > 0.5 and column value 1> 0.6 than print true else false
It sounds like you are only interested in assessing row 1 and column 1 which are vectors of two different lengths. If you want to do something different, please explain more clearly the goal.
abc_data = rand((randi(20)),2)
% For row 1
abc_data(1,:) > 0.5
% For col 1
abc_data(:,1) > 0.6
% For all rows (if any values are > 0.5)
any(abc_data > .5, 2)
% For all columns (if any values are greater > 0.6)
any(abc_data > .6, 1)
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Random Number Generation 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!