Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
次の行:
a=[1;2;10;9] eye(10)(a,:)
戻る:
[1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0]
それはどのように機能しますか?なぜそれは価値を得たのですか?
10x10単位行列から行1、2、10、9およびすべての列を選択します。
以下のような中間ステップがないと、構文エラーが発生します。そのステップをスキップしましたか、それともこのMatlabバージョン間でこの構文を変更しましたか?
a=[1;2;10;9]; eye(10)(a,:)
収量??? Error: ()-indexing must appear last in an index expression.
??? Error: ()-indexing must appear last in an index expression.
これはあなたが投稿したマトリックスを与えます:
e = eye(10); e(a,:)