01-27-2014 02:04 PM
Brad:
I'm at a loss as to how to convert this function from Matlab to Diadem...any suggestions? In Matlab it would convert the number to a string
Akj=num2str(j) ',' num2str(j)];%write the subscripts as strings with a comma to serparate rows and columns
02-04-2014 05:12 PM
Hi jgabe,
Here's a start for you. You loop For i = 1 to imax, the concatenation operator is "&", the string constant character is ", every if needs a then, the comment character is ' etc.:
'fill the matrices of simultaneous equations
n=0
for i = 1 to (nfil-1)
for j = (i+1) to nfil
Aij = "[" & i & "," & j & "]" 'write the subscripts as strings with a comma to serparate rows and columns
n = n + 1
nn = 0
for ii = 1 to (nfil-2)
for jj = (ii+1) to nfil
for kk = (jj+1) to nfil
nn = nn + 1
Bii = CStr(ii) 'write the subscripts as strings
Bjj = CStr(jj)
Bkk = CStr(kk)
if strcomp(Aij, "[" & Bii & "," & Bjj & "]") then 'compare subscripts as strings with row and column separated by a comma
MatUR(n,nn) = MatUR(n,nn) + 1
MatLL(nn,n) = 1
elseif strcomp(Aij, "[" & Bjj & "," & Bii & "]") then
MatLL(nn,n) = -1
elseif strcomp(Aij, "[" & Bjj & "," & Bkk & "]") then
MatUR(n,nn) = MatUR(n,nn) + 1
MatLL(nn,n) = 1
elseif strcomp(Aij, "[" & Bkk & "," & Bjj & "]") then
MatUR(n,nn) = MatUR(n,nn) - 1
MatLL(nn,n) = -1
elseif strcomp(Aij, "[" & Bkk & "," & Bii & "]") then
MatUR(n,nn) = MatUR(n,nn) + 1
MatLL(nn,n) = 1
elseif strcomp(Aij, "[" & Bii & "," & Bkk & "]") then
MatUR(n,nn) = MatUR(n,nn) - 1
MatLL(nn,n) = -1
end if
next
next
next
next
next
Brad Turpin
DIAdem Product Support Engineer
National Instruments
02-04-2014 05:36 PM
thanks Brad! Your awesome!
02-05-2014 09:08 AM
Hi jgabe,
I expect more questions, this is really just the first step, but hopefully it'll get you jumpstarted some.
Brad Turpin
DIAdem Product Support Engineer
National Instruments