フィルターのクリア

Taking a few columns out of a big array and making a new smaller one

3 ビュー (過去 30 日間)
Bennett Torrance
Bennett Torrance 2017 年 2 月 3 日
コメント済み: Image Analyst 2017 年 2 月 3 日
I have a data array with 24 columns and a 10k+ rows of data. I want to take 4 of the columns (column 2,4,8,and a constant value of "1900") and make a new array for calculations. How do I do this?

採用された回答

Image Analyst
Image Analyst 2017 年 2 月 3 日
編集済み: Image Analyst 2017 年 2 月 3 日
Try this:
smallArray = bigArray(:, [2,4,8]); % Extract columns 2, 4, 8.
Actually, I'm not sure what the "and a constant value of "1900"" means for your array of 24 columns. If you want to tack on a column of all values of 1900, do this
smallArray = [smallArray, 1900*ones(size(smallArray, 1), 1)];
  3 件のコメント
Bennett Torrance
Bennett Torrance 2017 年 2 月 3 日
How would I make it so the 1900 column is the first column instead of the last one?
Image Analyst
Image Analyst 2017 年 2 月 3 日
Just put it in front:
smallArray = [1900*ones(size(smallArray, 1), 1), smallArray];

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrices and Arrays についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by