0

I have Matlab code with variable (value varies frequently, say 10 times/Sec) and I want to use that variable's value in second life script i.e. LSL Script. I read somewhere to do this with HTTPRequest/Response methods, but my Matlab code is developed for desktop application. And I do not know much about LSL script.

kAmol
  • 1,297
  • 1
  • 18
  • 29

1 Answers1

1

I think you have quite a bit of learning ahead of you. First you need to choose an interface to the Matlab data. It supports access via many languages, including common Internet-friendly languages. You'll need to get that data to the Internet somehow so that it can communicate with a region server running. Since it supports access via external languages, I think you're in good shape there.

The main question in my mind is whether you are referring to dynamic data. Is the data changing, and you want to provide access to real-time updates in your LSL script? Or are you referring to a historical recording of data that was changing 10 times per second (in other words, a data file)?

If the data is static, and not too large, you could just convert it into a text format, include it in the Contents of the prim with the LSL script, and read that with the Notecard functions in LSL.

Alternatively, you could somehow push it to a file on a hosted website, then use llHTTPRequest from your LSL script to fetch it. You can also do this if it's changing infrequently, and occasional updates are sufficient.

However, if the data is constantly changing, and ideally if MatLab has a way of notifying a remote Internet webserver (for example, if it does HTTP PUTs to a URL with regular updates), or if you can write a script at your end to fetch the data from MatLab and send it to an LSL object, you could directly contact an object in-world via LSL's HTTP-In functionality. See llRequestURL and the http_request event documentation.

There are some good examples on those pages.

Appurist - Paul W
  • 1,291
  • 14
  • 22