×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# SMath For Loops - Populate a matrix

 Forum Search FAQs Links MVPs

## SMath For Loops - Populate a matrix

(OP)
Is anyone good at SMath?

I'm trying to loop through 1 matrix and populate another matrix.

I would like to go through each term in the 'V' matrix and populate the 'q_z_vector' matrix. (I've stripped all the units out for now)

I can't get it to work? And I can't find the answer on the Smath website.

Thank you in advance.

### RE: SMath For Loops - Populate a matrix

Something like:

Rather than think climate change and the corona virus as science, think of it as the wrath of God. Feel any better?

-Dik

### RE: SMath For Loops - Populate a matrix

Sorry I didn't explain the process... do a 'for' loop and in the box after the 'contained' symbol, type in 'range' and select range 2 or whatever from the dropdown presented. With the range presented enter the first and last values in the 'squares' presented.

Rather than think climate change and the corona virus as science, think of it as the wrath of God. Feel any better?

-Dik

### RE: SMath For Loops - Populate a matrix

(OP)
Thanks Dik! It's working like a champ now!

### RE: SMath For Loops - Populate a matrix

In case you're curious, you can use units within the array... different columns can have different units... in my example for the first row... 1 is a number, 2 is a diameter in inches, and 3 is an area in sq. inches... bd(i,3) is in sq.in. automatically. I use this feature a lot. I really like the program... a couple of little hiccups, but overall, excellent. I've attached a print of my cover page... I use the little blue squares to line up my output data. The one on the far right is to line up comments, the one in the middle is for metric units and the one on the left is for imperial units. Most of my programs output to both Imperial and Metric. I'm a bit of a dinosaur in that I 'understand' imperial but a lot of people are comfortable with metric. I can look at the imperial data and I know what it says, without thinking about it... with metric, I have to convert to imperial (mentally) to understand something. I'm just too old.

Rather than think climate change and the corona virus as science, think of it as the wrath of God. Feel any better?

-Dik

### RE: SMath For Loops - Populate a matrix

(OP)
I'll give the units within the array a shot. I've tried in the past, and have not been able to get it to work.

Ideally, I would like the array to look more like a table. The first column would be text (Risk Cat 1,2,3,4), and then other columns be the numerical values.

### RE: SMath For Loops - Populate a matrix

(OP)
Also, I like you first cover page....I copied you user defined functions for design checks a long time ago.. :)

### RE: SMath For Loops - Populate a matrix

from another program... using all kinds of units... and shows the imperial, metric, and description outlined by the blue squares.

Rather than think climate change and the corona virus as science, think of it as the wrath of God. Feel any better?

-Dik

### RE: SMath For Loops - Populate a matrix

I should have added... I 'cut and paste' code from one program into another... the HSS array and calculations used above has been cut and pasted into maybe 6 or 8 programs, already. The properties calculated are specifically for the NDX item selected from the array. I could have programmed them into the array, but chose not to to keep the physical size of the array relatively small. It would be handy if you could insert a line in the array, rather than add it to the bottom.

Rather than think climate change and the corona virus as science, think of it as the wrath of God. Feel any better?

-Dik

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

#### Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members! Already a Member? Login

#### Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Design for Additive Manufacturing (DfAM)
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a partâ€™s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!