How can I take part of vector

428 ビュー (過去 30 日間)
skysky2000
skysky2000 2017 年 1 月 31 日
コメント済み: Stephen23 2017 年 1 月 31 日
Dear all; I have vector a=[1 2 5 66 7 88 9 0 23 12] and c=4; The question is , How can i take first 4 cell from vector a depend on c
result = [ 1 2 5 66];
Thanks for always helping me....
  1 件のコメント
Stephen23
Stephen23 2017 年 1 月 31 日
This kind of very basic MATLAB usage is introduced in the Introductory Tutorials. All beginners should do the introductory tutorials, because otherwise they will not know how to use basic MATLAB concepts:

サインインしてコメントする。

採用された回答

John D'Errico
John D'Errico 2017 年 1 月 31 日
It is time for you to read the getting started tutorials about MATLAB. In there you will have learned to use indexing, and such basic ideas as the colon operator.
result = a(1:c);
  1 件のコメント
skysky2000
skysky2000 2017 年 1 月 31 日
That amazing John . I appreciate it
cheers..

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by