Are you blogging on PH? Get your free blog.

Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 553
Number of posts: 954

This Forum Only
Post New Thread

Report
guys need ur help plz Posted by ahmed_seh on 27 Oct 2009 at 12:00 PM
hi guys, i need ur help
i have a matrix contains (let's say 30 elements)

how can i split or chunk them into 30 variables, where each variable contains 1 element of the biggest one,,,

let's take this example 2 make it clear 4 u,

a=[ 1 2 3 4 5 6 7 8 9], here a contains 9 elements, so how can i split them into 9 variables where each variable contains 1 element of a!!!!??? is it clear now!!!!
i hope that

remember guys, number of variables depend on the number of element of the biggest matrix

waiting ur replies

thank u very much
Report
Re: guys need ur help plz Posted by jjasso5 on 27 Oct 2009 at 12:50 PM
Two ideas:

1. You can access the individual elements, like this:
if x=[3 2 1] then, you get

x(1) = 3
x(2) = 2
x(3) = 1

2. Or, if you want to create new variables, then
y = x(1)
z = x(2)
w = x(3)

For Matlab tutorials, I suggest you visit the site
http://www.matrixlab-examples.com/matlab-tutorial.html



 
Popular resources and forums for programmers on Programmersheaven.com
Assembly, Basic, C, C#, C++, Delphi, Java, JavaScript, Pascal, Perl, PHP, Python, Ruby, Visual Basic
© Copyright 2009 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin. Read the latest words from the publisher here.
Be the first to sign up for Lars Hagelin’s In-depth Outsourcing Newsletter here.
bootstrapLabs Logo A bootstrapLabs project.