Deletion of Matrix Column Using " linalg::delCol " Command

1 回表示 (過去 30 日間)
Jay
Jay 2014 年 10 月 18 日
コメント済み: Image Analyst 2014 年 10 月 19 日
I am trying to delete the second column in the below matrix using the command:
linalg::delCol(network_station_coordinates_dbl,2 )
1 NaN 5125.06200000000 1201.78500000000
2 NaN 5310 1430
3 NaN 5700 1190
4 NaN 5280 1030
but I receive the following error:
_Cell contents reference from a non-cell array object._
_Error in cell2mat (line 43)
cellclass = class(c{1});_
_Error in Program_2014 (line 131)
network_station_coordinates_dbl =
cell2mat(network_station_coordinates_cel)_
Can someone please explain to me why this is and what I require to solve this issue?

採用された回答

Image Analyst
Image Analyst 2014 年 10 月 18 日
network_station_coordinates_cel is not a cell array but you're passing it to cell2mat. Do
whos network_station_coordinates_cel
and see what it says.
Also, I don't believe :: (double colon) is a valid MATLAB operator, at least not that I've ever seen.
  2 件のコメント
Image Analyst
Image Analyst 2014 年 10 月 19 日
Justin's "Answer" moved here since it's not an answer to the original question but a reply to me:
Hi Image,
I searched the internet for a way of deleting columns and rows of a matrix and found the linalg::delCol command.
I then looked at how to use it in MatLabs Help file.
It states it is a valid command but will not process when I try to use it (returns an error).
Image Analyst
Image Analyst 2014 年 10 月 19 日
If "network_station_coordinates_dbl" is the name of your variable and you want to delete the second column, do this:
network_station_coordinates_dbl(:,2) = [];

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by