フィルターのクリア

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 回表示 (過去 30 日間)
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

採用された回答

Jan
Jan 2017 年 5 月 23 日
編集済み: Jan 2017 年 5 月 23 日
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.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by