フィルターのクリア

Making a three column matrix

17 ビュー (過去 30 日間)
Liliana Sierra
Liliana Sierra 2017 年 12 月 13 日
回答済み: Liliana Sierra 2017 年 12 月 13 日
Hi everyone! I am having trouble with the following: I have built a 31 row by 3 columns ceros matrix and I am trying to index values to each column, I want my first column to go from 140 to 440(this are lengths), but when trying to do so my values start from 0, then 140, then 440... Then in the second column I want the values of column 1 to appear because I need to compare how many lengths are being acumulated( this to later build a histogram..) I would very much appreciate your help!
  4 件のコメント
Liliana Sierra
Liliana Sierra 2017 年 12 月 13 日
yes I want column one to go from 140,141,142,143 I am trying this:
c=zeros(300,3); c(:,1)=[140:1:440]'; c(140,1)=140
Liliana Sierra
Liliana Sierra 2017 年 12 月 13 日
it was a 300 row by 1 column matrix.. sorry I got confused when I first posted the question..

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

採用された回答

Raul Andres Lopez Romero
Raul Andres Lopez Romero 2017 年 12 月 13 日
Your code has only one error when you set the C matrix in 300 rows and 3 columns, and try to fill it with numbers starts in 140 to 440 with steps of 1 unit you have a 301 elements so, the C matrix needs to be 301 rows not 300. (if the number starts in 141 so, there is a 300 elements vector)
the code:
C=zeros(301,3);
C(:,1)=[140:1:440]'

その他の回答 (1 件)

Liliana Sierra
Liliana Sierra 2017 年 12 月 13 日
Thank you!

カテゴリ

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