Re: Row inserting
- From: "Ken Davis" <ken.davis@xxxxxxxxxx>
- Date: Tue, 31 Jan 2006 14:02:24 -0500
"John Brown" <johnbrown@xxxxxxxxx> wrote in message
news:ef27478.-1@xxxxxxxxxxxxxxxxxxx
> Hi,
> I am looking for a matlab function to insert a new row to an existing
> matrix. Can anyone help me?
> Thanks...
Okay... I'll bite, though I'm sure there are better ways than this.
>> a = randn(7)
a =
-0.0592 0.3803 -1.8740 0.5689 0.3148 0.2120 0.0880
-1.0106 -1.0091 0.4282 -0.2556 1.4435 0.2379 -0.6355
0.6145 -0.0195 0.8956 -0.3775 -0.3510 -1.0078 -0.5596
0.5077 -0.0482 0.7310 -0.2959 0.6232 -0.7420 0.4437
1.6924 0.0000 0.5779 -1.4751 0.7990 1.0823 -0.9499
0.5913 -0.3179 0.0403 -0.2340 0.9409 -0.1315 0.7812
-0.6436 1.0950 0.6771 0.1184 -0.9921 0.3899 0.5690
>> i = 5
i =
5
>> b = ones(1, 7)
b =
1 1 1 1 1 1 1
>> a = [a(1:i,:); b; a(i+1:end, :)]
a =
-0.0592 0.3803 -1.8740 0.5689 0.3148 0.2120 0.0880
-1.0106 -1.0091 0.4282 -0.2556 1.4435 0.2379 -0.6355
0.6145 -0.0195 0.8956 -0.3775 -0.3510 -1.0078 -0.5596
0.5077 -0.0482 0.7310 -0.2959 0.6232 -0.7420 0.4437
1.6924 0.0000 0.5779 -1.4751 0.7990 1.0823 -0.9499
1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000
0.5913 -0.3179 0.0403 -0.2340 0.9409 -0.1315 0.7812
-0.6436 1.0950 0.6771 0.1184 -0.9921 0.3899 0.5690
.
- Follow-Ups:
- Re: Row inserting
- From: John Brown
- Re: Row inserting
- References:
- Row inserting
- From: John Brown
- Row inserting
- Prev by Date: Collision Detection in Simulink with VRML Model
- Next by Date: Re: Row inserting
- Previous by thread: Re: Row inserting
- Next by thread: Re: Row inserting
- Index(es):
Relevant Pages
|