How to apply a relational operator on a cell in MATLAB?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Haitham AL Satai
am 20 Sep. 2022
Kommentiert: Haitham AL Satai
am 20 Sep. 2022
I would like to know the number of values that are less than 0.0038 in a cell of 41 X 41 double.
For example, I have the cell below:
B = num2cell(rand(41));
When I applied such condition
sum(A(:) < 0.0038)
, it gave me an error, which is Operator '<' is not supported for operands of type 'cell'.
So, do I need to convert the cell to a matrix and apply the operation? Or is there any specific way to use this condition on the cell directly?
2 Kommentare
Stephen23
am 20 Sep. 2022
B = num2cell(rand(41));
Why use such an inefficient approach to storing numeric data?
Most likely your task would be much simpler if you used a numeric array.
Star Strider
am 20 Sep. 2022
‘Or is there any specific way to use this condition on the cell directly?’
Yes.
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing 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!