Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Operating on similar elements of different structures
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
Alan

Posts: 48
Registered: 7/30/13
Operating on similar elements of different structures
Posted: Jul 30, 2013 11:16 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello,

I'm new to using structures and have a question on how to interact with them.

Is there a way to do the same operation on the same parts of different structs?

For example, I've been doing something like this in my scripts:

for k = 1:10
struct(k).arraytwo = struct(k).arrayone * 9.81;
struct(k).arraythree = struct(k).arrayone > 0;
struct(k).arrayfour = cumsum(struct(k).arraythree);
.....
end

Is there a way to do this without the for loop? like some clever indexing?

thanks!




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.