[Date Index]
[Thread Index]
[Author Index]
Re: fill the empty spaces in a matrix
*To*: mathgroup at smc.vnet.net
*Subject*: [mg46678] Re: [mg46625] fill the empty spaces in a matrix
*From*: Tomas Garza <tgarza01 at prodigy.net.mx>
*Date*: Fri, 27 Feb 2004 19:32:07 -0500 (EST)
*References*: <35A9B2FA0511A74E9C5CDE284F052708042E72EF@tor-exm-03.wireless.corp.ads>
*Sender*: owner-wri-mathgroup at wolfram.com
Ok, now I see. If you actually have empty spaces, but separated with a
comma, then use ReplaceAll:
In[1]:=
aa = {{0, , 0}, {0, 0, 0}, {0, 0,}}
Out[1]=
{{0, Null, 0}, {0, 0, 0}, {0, 0, Null}}
In[2]:=
aa /. Null -> 0
Out[2]=
{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}
If you have a symbol, say x (provided x has not been assigned a numerical
value), then
In[3]:=
bb = {{0, x, 0}, {0, 0, 0}, {0, 0, x}}
Out[3]=
{{0, x, 0}, {0, 0, 0}, {0, 0, x}}
In[4]:=
bb /. x -> 0
Out[4]=
{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}
Tomas
----- Original Message -----
From: "Mike Bauer-TM" <Mike.Bauer at telus.com>
To: mathgroup at smc.vnet.net
Subject: [mg46678] RE: [mg46625] fill the empty spaces in a matrix
Lets say aa is my matrix the spaces x marks the empty space. If I try to use
this matrix in a calculation Mathematica will have a problem because the
matrix in not even. Mathematica will see that the first row (0 x 0) does not
have the same amount of elements as
row 2 (0 0 0 ). Is there a way to tell Mathematica to automatically fill in
the empty segments (x) with '0'.
/ 0 x 0 \
aa= | 0 0 0 |
\ 0 0 x /
or
aa= {{0, ,0},{0,0,0},{0,0, }};
sorry for the misunderstanding.
-----Original Message-----
From: Tomas Garza [mailto:tgarza01 at prodigy.net.mx]
To: mathgroup at smc.vnet.net
Subject: [mg46678] Re: [mg46625] fill the empty spaces in a matrix
I'm sorry about my ignorance, not knowing what you mean by an "uneven"
matrix.
In any case, you must specify which are the empty positions you want to
fill.
Tomas Garza
Mexico City
----- Original Message -----
From: "Mike Bauer-TM" <Mike.Bauer at telus.com>
To: mathgroup at smc.vnet.net
Subject: [mg46678] [mg46625] fill the empty spaces in a matrix
>
> Hi all,
>
> I have an uneven matrix
> / 0 0 \
> aa= | 0 0 0 |
> \ 0 0 /
> I want to fill the empty spaces with 0's, how do I do that.
>
> thank you
>
>
>
>
>
Prev by Date:
**Re: eigenvector rotation**
Next by Date:
**Re: Draws from Multivariate Normal Distribution**
Previous by thread:
**RE: fill the empty spaces in a matrix**
Next by thread:
**FindMinimum**
| |