Taking a few columns out of a big array and making a new smaller one
3 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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 个评论
Image Analyst
2017-2-3
Just put it in front:
smallArray = [1900*ones(size(smallArray, 1), 1), smallArray];
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!