Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

SMath For Loops - Populate a matrix

Status
Not open for further replies.

JoelTXCive

Civil/Environmental
Jul 24, 2016
919
US
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)

Velocity_Pressure_by_Cat_itv77y.jpg


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

Thank you in advance.
 
Replies continue below

Recommended for you

Something like:
image_jqqdub.png

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

-Dik
 
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
 
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.

image_hlisx6.png


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

-Dik
 
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.

 
Also, I like you first cover page....I copied you user defined functions for design checks a long time ago.. :)
 
from another program... using all kinds of units... and shows the imperial, metric, and description outlined by the blue squares.

image_zbad60.png


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

-Dik
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top