[SciPy-user] Breaking up a vector into it's components

Perez Kawumi pepe_kawumi@yahoo.co...
Wed Sep 5 10:06:41 CDT 2007


Hullo,
I have solved a problem in matlab but want to convert it to python. Vec_field(ii,jj,:) returns the components of the vector. The matlab operation is shown below. I have just used dummy variables to explain what I want to do as shown below.
 vec_field(ii,jj,:)=[n m] 
where the right hand side is a 1*2 matrix

Im having a problem finding the write python syntax that will be able to do the same pattern as shown below.

vec_field(1,1,:)=[4 2]
vec_field(:,:,1) =
     4

vec_field(:,:,2) =
     2
>> vec_field(1,2,:)=[3 4]
vec_field(:,:,1) =
     4     3

vec_field(:,:,2) =
     2     4
>> vec_field(2,1,:)=[5 7]
vec_field(:,:,1) =
     4     3
     5     0

vec_field(:,:,2) =
     2     4
     7     0
>> vec_field(2,2,:)=[8 9]
vec_field(:,:,1) =
     4     3
     5     8

vec_field(:,:,2) =
     2     4
     7     9

Is there a command in python that will enable me to do this?
Thanks Perez


	
	
		
___________________________________________________________ 
Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20070905/2b729168/attachment-0001.html 


More information about the SciPy-user mailing list