Hello,
I think you really have 3 questions/issues here:
1. "calculate for how much time the alarm remains ON"
To compute the time between points in your code you can use the attached little example called "ms stopwatch.vi" which uses a functional global (uninitialized shift register) to store the value of the ms timer across runs. The other VI calls this VI (twice) to illustrate how to use it. Basically, it should be called with the "Reset" parameter just before the code to time, and then called with the "Get Elapsed Time Since Last Reset" just after the code to time.
2. "How do I compare the generated SOP with the pressure values. Basically I want a graph to show me what is the corresponding pressure."
If you describe exactly what data you have, and exactly what you would like to compute, I think I can help you further. When you say, "But in reality, I will just know the values of SOP and will have to what pressure it corresponds to" do you mean that you will have to compute which pressures they correspond to using an equation? For this you will use the numeric palette. Do you mean you need to use a table to "look up" which pressure correponds to a given SOP value? If so, how is that table stored - you could put it into a 2D array and then index the values using the array index function to get the correct pressure.
3. "pass this info to a program in matlab"
For this you can have your LabVIEW program write whatever data you will need in your matlab program to a file, and then read that file in your matlab program.
I hope this helps! Please study the example code carefully so that you understand how to use the timer VI I have attached. The concept is rather simple once you understand that the shift register (the left terminal of the shift register) in the ms stopwatch VI will retain the value that was last written to it across calls to the VI.
Best Regards,
JLS