Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
creating a particular area of a matrix into NaN

Subject: creating a particular area of a matrix into NaN

From: Bal kishore Pandey

Date: 17 Nov, 2011 16:11:11

Message: 1 of 2

Dear matlab users,
I have an querry on how to convert a specific row or column value of a martix into NaN.
For eg: i have a 5x5 matrix. And i want the values in the 2,3 row and 2,3 column to be NaN.
To do this i write.
a(2:3,2:3)={NaN};
But when i execute it, i get an error
??? The following error occurred converting from cell to double:
Error using ==> double
Conversion to double from cell is not possible.

Is there any other way this could be accomplished?

P.S this is just an example matrix, the matrix i am going to implement this is a 1000x800 matrix. And i want row 20 to 225, 455 to 465, 740 to 760 and coloumn is any random value from 1 to 800.

Subject: creating a particular area of a matrix into NaN

From: ade77

Date: 17 Nov, 2011 16:27:11

Message: 2 of 2

"Bal kishore Pandey" <balkishore.pandey@gmail.com> wrote in message <ja3bmu$b8o$1@newscl01ah.mathworks.com>...
> Dear matlab users,
> I have an querry on how to convert a specific row or column value of a martix into NaN.
> For eg: i have a 5x5 matrix. And i want the values in the 2,3 row and 2,3 column to be NaN.
> To do this i write.
> a(2:3,2:3)={NaN};
> But when i execute it, i get an error
> ??? The following error occurred converting from cell to double:
> Error using ==> double
> Conversion to double from cell is not possible.
>
> Is there any other way this could be accomplished?
>
> P.S this is just an example matrix, the matrix i am going to implement this is a 1000x800 matrix. And i want row 20 to 225, 455 to 465, 740 to 760 and coloumn is any random value from 1 to 800.


remove the curly brackets.
 a = ones(5)
a(2:3, 2:3) = nan

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us