Deletion of Matrix Column Using " linalg::delCol " Command
1 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
采纳的回答
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
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
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 Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!