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
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Curve Fitting Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!