cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Plz help me with condition and exporting to excel

sm�ller-2
11-Garnet

Plz help me with condition and exporting to excel

Hey, i could manage the automatic calculation of a routine for all load cases. But i would need help with the condition which should apply for all calculated cases. THe Reult NOK OK should the given nexto the calculated routine (load case).

After that i want to make a writeexcel to transfer it into Excel.

How can i say in readexcel which columns on which sheet i want to import.

I have so far this file

THx guys 😃

27 REPLIES 27

I am confused - is this a follow up to this tread ->‌ Using Excel Database in MathCAD ?

At least the Excel and the Mathcad sheet you posted look like the sheets I had posted there.

How can i say in readexcel which columns on which sheet i want to import.

Concerning the rest of your question - could it be that you are looking for something like this:

WE

A sorry it should be only an example.

Up to now it is not working properly. I could manage the calculation of load cases but the comparison between the maximum allowable value and the actual value is not working. I think its only a failure in the last few stuff.

Here are my 2 files:

A and i need to save the mathcad File after every operation so i then have one File for every load case (Path for saving should be given in the Routine).

The Name should be the load case given in the vector of the Mathcad File

And is it possible to integrate a Button for start Calculation??

Big THx =)))

and one other thing. If im going to import a big Array from Excel and there are empty cells in excel. The Matrix for calculating the LOad Case Results contains "NaNs"

Now is it possible to exclude this cases? Because its not working then when calculating a load case with NaN. So i need to delete the NaN values in the Matrix

You can check if a variable has the value NaN using "IsNaN"

if IsNaN(variable)

.....

R

I am still not sure what exactly it is you are looking for.

Do you want to compare all values in A against 5 or against the corrsponding value in B?

Your sheet contains so many trials that its quite confusing and not clear, what you really wan to achieve.

You may consider cutting down the sheet to its bare bones and at the places, you are not able to get what you want, explain what exactly you are about to try in vain. How exactly the result you need  should look.

> A and i need to save the mathcad File after every operation so i then have one File for every load case (Path for saving should be given in the Routine).

Using scripted components you might be able to automatically work through every Excel sheet in a given directory and save back the results. I am not quite sure what a "load case" should be in that context.

> And is it possible to integrate a Button for start Calculation??

Yes, but whats wrong with the Mathcad sheet starting to work right when it loads? (Autocalculation on)

WE

Hey thx for help sofar. I made the Routine better now!

I only need help with the comparison of the vectors.

As you said i need to compare the resulting vector with another Vector, which contains the maximum allowable values.

For example:

actual Force is smaller than maximum allowable Force.

I attached the Files now, which are much better to understand.

I only have problems with the OK NOK routine 😞

Is there a possibility to add the save routine after each calculation step with a certain folder path i can choose before starting the calculation routine?

Big thx 😃

OK, I think I know what you were after, now.

I added a commented worksheet.

In short:

Don't read in the header line, if you don't need it.

Don't read in 5000+ lines, if you only need 958

As your case numbers are consecutive numbers beginning by 1, you could omit the lookup regions and index ranges and simply add the appropriate column vectors

I don't know what you intended here:

And to answer your main question - I guess this is what you were looking for:

> Is there a possibility to add the save routine after each calculation step with a certain folder path i can choose before starting the calculation routine?

What is considered a "calculation step"? The calculation of OK or NOK of just one single line out of the 958?

WE

Hey, big thx you helped me so!!!!!!!!!!!!!!

I did it on this way because i didnt knew the right stuff what i needed to write.

I was thinking to do it like you saied but i didnt knew how.

Save Operation:

I want to automatically save the mathcad File after every step i. The Name of the Mathcad File should be the load case name?

So that i have the results for every load case as one extra File.

Big thx!!!!!!!!!!!!!!!!

The reason why i loaded ion the big matrix is because i so only need to change the Number of loadcases which should be calculated and didnt need to change the Input Matrix itself.

Is it also possible to integrate a start Button on which the Routine is activaqted? Thx

Are you sure you want to save the Mathcad file itself? It won't change and reamin the same and you would end up with 958 Mathcad files all with the very same content.

I don't think that this is what you want.

WE

I need it for Report.....

I know its very the same but i pick up my needed Load Cases then.

For example: Load Case 123_Lenth_150

i was thinking i can save the calculation with the values for the Calculation?

example:

after saving step i have the result for the variable. I can place the formula after the result and i have a calculation for every load stepexample

3 = Fxp

Condition

Fxp < Fzul x pzul    Conition: true

just placing the Formula how i calculated the result value as example.

Not sure whats going on here.

All I see is:

i was thinking i can save the calculation with the values for the Calculation?

example:

after saving step i have the result for the variable. I can place the formula after the result and i have a calculation for every load stepexample

3 = Fxp

Condition

Fxp < Fzul x pzul    Conition: true

just placing the Formula how i calculated the result value as example.

Now I see those replies.

Looks like this is the effect of moderation-

The text could be more informative, though.

I still don't know what exactly you would call an calculation step and what you intend the saved file (obviously you really want to save 958 Mathcad files) to contain.

Would you word it that way that the file as it is now contains 958 calc steps?

As I already wrote you would end up with 958 copies of the very same file, if your goal ist automatic calculation.

If you change your Mathcad file by hand, then I guess you are better off saving it by hand, too.

WE

Ok im trying to explain:

this is the Vector which is calculating the actual stress for example:

THis is for example one of the values which is used for calculating:

What i want now is:

I need a Mathcad File for every loadcase with the inserted values (which is given by the Number i). For Example:

Save me a mathcad File with all values for i=1 to End of Loadcases.

So that

Leads to the real value for i=1

and same way for

use i=1 and save for every Operation to the end of the loadcases.

I need the Result of the Operation as Value. And The Condition with the OK NOK for every Mathcad File.

I hope i could describe what i need.

I hope this is possible. And you can provide me with a solution. Would be great. I learned so far a lot thx fof your Tipps=)

best regards Stefan

Hmm, so you want Mathcad to replace the i in the sverweis command for the actual value in the loop and then automatically save itself with a name containig the value of i or with a name provides by manual input.

I am not a script expert, but I don't think that this is possible (and honestly I am still not able to see much sense in doing so, but thats another story).

WE

Hmm jea i need for further analysis and reporting The Mathcad File with the inserted values for i because i need to do a documentation and for that i can insert a picture with the Formula so that i have a Calculating Report for every Loadcase. And For that i need the real values wich leads to the result and Parameters.

Coz of the needed Calculationreport for every Loadcase. Hmm

Hmm but thx for the help so far. Maybe you know if there is a possibility or a command in mathcad to perform a saving process.

Hmm should i open a new Question regarding saving process while performing a Loop ?

Yea The Name of the saved file should be The column with the load Case for example Load Case 1, insert i=1, and save the File with the Name "1" or whatever there is standing in the column.

Important is the Value for the Result as number for every loadcase

Hmm should i open a new Question regarding saving process while performing a Loop ?

Maybe worth a try.

ok thx. Do you know such a command?

LucMeekes
23-Emerald III
(To:Werner_E)

It wasn't answered some years ago... Automate saving of Mathcad file

Maybe it's just not possible.

One last Question:

How can i add this Calculation for every Load step:


a1 ...Parameter a in load case 1

a2... Parameter in load step 2

If a1=1 perform Calculation Case 1

If a1=2 perform Calculation Case 2

If a1=3 perform Calculation Case 3

If a1=4 perform Calculation Case 4

for every step until end of loadcases and show me the resulting vector to export in excel?

Would be great if you can help me one last time with the programcode

I also made it now much easier and efficienter =))

The attached file should help, I hope.

But I am absolutely not sure, if my crystal ball correctly told me what you really need.

WE

Best thx thats what i need depending on a value in a certain column performing one of 4 calculations for every load step and checking weather its ok and nok!!!!!!!!

Top Tags