Filter löschen
Filter löschen

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

2 Ansichten (letzte 30 Tage)
Jay
Jay am 18 Okt. 2014
Kommentiert: Image Analyst am 19 Okt. 2014
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?

Akzeptierte Antwort

Image Analyst
Image Analyst am 18 Okt. 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 Kommentare
Image Analyst
Image Analyst am 19 Okt. 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 am 19 Okt. 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) = [];

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by