I am trying to make a comprehensive UNIFAC model program (it is an activity coefficient model used in chemical engineering). Currently I have it running and it works correctly, except for the user to be able to use this program for any size mixture system, they must edit the component matrices manually. For instance, if there are two species in the mixture, the user must edit the first vector to have two components and input the corresponding values, and they must edit the second matrix to have two rows and then they must input the corresponding values. What I want my program to be able to do is have the user input the number of components and this variable will produce both the vector and the matrix of the correct corresponding sizes. After these are created, then the user needs to be able to edit the values of the matrix and input the data that they need to run. I know how to make both vectors and matrices of variable sizes but what I need help with is making these resultant vectors and matricies able to be edited by the user to where they can input the data they need to run in the system.
Solved! Go to Solution.
Please don't cross post. It leads to confusion and wastes peoples time because you can the same answers in more then one place.
Which version of Mathcad are you using?
I know this is an old post now, but the zipped file shared previously sounds like what I need as well, but it won't open in Prime 6.0. Is it possible to get an updated copy of that "Empty matrix creation.xmcdz" worksheet shared here, or possibly a pdf so that I could at least see what was done in that previous version as far as syntax and so forth? Any help is much appreciated!
Vladimir sent you the converted file but you may notice that some regions are just converted to pictures, rendering the converted sheet useless. The reason is that the older Mathcad versions were much more powerful than the Prime versions which miss a lot of features. Some of the features not available in Prime like embedding symbolic calculations in a program or the used of scripted components were use by Richard in his sheet and thats the reason its not working in Prime.
In case you are interested here is what it looks like after pressing the "Define Matrix" button
and here is the scipt part of the component:
Option Explicit Dim State Text = "Define Matrix" Sub PushBtnEvent_Start() Rem TODO: Add your code here End Sub Sub PushBtnEvent_Exec(Inputs,Outputs) Dim Regtag, Reg, XML, Val, n, m, i, VarName If State = 0 Then Exit Sub Regtag = Inputs(0).Value For Each Reg in Worksheet.Regions If Reg.tag = Regtag Then Exit For Next If Not IsObject(Reg) Then MsgBox "Region tag """ & Regtag & """ not found",_ vbOKOnly + vbExclamation, "Error" Exit Sub End If If State = 2 Then XML = "<ml:define xmlns:ml=""http://schemas.mathsoft.com/math20"">" & vbCrLf & "<ml:id xml:space=""preserve"">MyMatrix</ml:id>" & vbCrLf & "<ml:str xml:space=""preserve"">Matrix not assigned yet</ml:str>" & vbCrLf & "</ml:define>" Reg.MathInterface.XML = XML Exit Sub End If State = 0 VarName = Inputs(1).Value n = Inputs(2).Value m = Inputs(3).Value XML = "<ml:define xmlns:ml=""http://schemas.mathsoft.com/math20"">" XML = XML & vbCrLf & "<ml:id xml:space=""preserve"">" & VarName & "</ml:id>" XML = XML & vbCrLf & "<ml:matrix rows=""" & n & """ cols=""" & m & """>" For i = 1 to n*m XML = XML & vbCrLf & "<ml:placeholder/>" Next XML = XML & vbCrLf & "</ml:matrix>" XML = XML & vbCrLf & "</ml:define>" Reg.MathInterface.XML = XML End Sub Sub PushBtnEvent_Stop() Rem TODO: Add your code here End Sub Sub PushBtn_Click() State = 1 PushBtn.Recalculate() End Sub Sub PushBtn_DblClick() State = 2 PushBtn.Recalculate()
Yeah, I'd noticed it was nonfunctional, but didn't realize how much was missing! Thanks for posting the script. I have to say, that is disappointing to hear that Mathcad has reduced functionality; definitely not the typical program development. This is probably my first time back to Mathcad since I worked at a previous employer that used it. That was mostly back pre-PTC, and I think v11 was the last one I'd used before now. Maybe I hadn't missed much after all if that's the direction they're heading with the software...
The concept and "development" of Prime sure are disappointing,
v11 is by many considered the best version ever. v12 was one of the worst versions, SUC was implemented and in v14 Maple was replaced by the much less capable muPad as symbolic engine. As Mathsoft and now PTC had to license muPad from Mathworks, PTC in Prime6 decided to replace muPad b the free FriCAS, which, as the examples which showed up here in the forum suggest, is again weaker than muPad. 😞
As of version which still can be licensed Mathcad 15 is the best choice but its not further developed by PTC- PTC adds it free (the same license file works for both) when you license Prime (buy the tail and get the dog).