Clear Filters
Clear Filters

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

1 view (last 30 days)
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?

Accepted Answer

Image Analyst
Image Analyst on 18 Oct 2014
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 Comments
Image Analyst
Image Analyst on 19 Oct 2014
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 on 19 Oct 2014
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) = [];

Sign in to comment.

More Answers (0)

Categories

Find more on Data Type Conversion in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!