hexagon logo

Loop in .cmd file to find row at a specific time.

I run a .cmd file after my sims to pull certain data and write it to a text file. I would like to get some numbers at a specific time in the sim. I'm trying to use a WHILE/END loop to do this per another example I found, but it isn't working. Code below...
 
var set var=CurrentAnalysis object=(eval(db_default(.system_defaults,"analysis")))
 
var set var=IP integer_value=1
 
While condition=((eval(CurrentAnalysis.object_value//".MyResult.time").values[IP])<2.5)
var set var=OneGTimeValue real_value=(eval(CurrentAnalysis.object_value//".MyResult.time").values[IP])
end
 
var del var=IP
 
Thoughts? Is there a better way?
Parents
  • First thing I notice is that you never increase the value of IP:
    var set var=IP int=(eval(IP+1))
    must be in there somewhere for it to work.
     
    Testing out syntax in the function builder sometimes is very helpful. I suspect that your construct might need a STOO to get the string to be seen as an object.
     
    But if you are just looking for the place where time=2.5, use VALI() or if you are looking for the value at some other signal when time=2.5, use VALAT().
Reply
  • First thing I notice is that you never increase the value of IP:
    var set var=IP int=(eval(IP+1))
    must be in there somewhere for it to work.
     
    Testing out syntax in the function builder sometimes is very helpful. I suspect that your construct might need a STOO to get the string to be seen as an object.
     
    But if you are just looking for the place where time=2.5, use VALI() or if you are looking for the value at some other signal when time=2.5, use VALAT().
Children
No Data