Effacer les filtres
Effacer les filtres

Ersetzern Sie alle Indices die Sie in Teilaufgabe c) ermittelt haben, mit einer einzigen Anweisung durch die Zahl 77, und weisen das Ergebis einer Matrix mit dem Namen C5_77 zu.

1 vue (au cours des 30 derniers jours)
C =
7 5 -6
6 8 4
7 2 8
Indices=C(find(C>5)) ----Hiermit habe ich versucht alle Werte in C zu finden die größer 5 sind.----
Indices =
7
6
7
8
8
Nun ist die Frage wie ich die Werte mit 77 erstezen kann.
Ich habe es folgendermasen versucht
C(Indices)=77 Wobei er hier für C nicht die Zahlenwerte Überschreibt sonder nur die Werte mit der Postionszahl C =
7 5 77
6 8 77
7 77 8
Bin blutiger Anfänger und würde mich über einen Tipp sehr freuen! Lg Jakob

Réponse acceptée

Jan
Jan le 23 Mai 2017
Modifié(e) : Jan le 23 Mai 2017
Indices = C(find(C>5))
This does not reply the "indices", as the names of the variable implies, but the values of C, which are lager than 5. The question asks for the indices and you do need the indices.
The shown code contains the required commands already, so I will help you although this is a homework question:
C(C > 5) % Without: find()
This replies all values of C, which are larger than 5. You can omit the find() and use this efficient "logical indexing". Now you want to assign the value 77 to these elements:
C(C > 5) = 77
By the way: We use English in this forum and the chances to get an answer grow, if more readers can understand the message. There is a German Matlab forum also on demand.

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by