Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Workspace sharing, Trigger events

Subject: Workspace sharing, Trigger events

From: Zahid Ullah Khan

Date: 3 Dec, 2005 02:54:31

Message: 1 of 4

I got two questions.
Question 1. Can one MATLAB access the workspace of another MATLAB?
Case 1: Assuming that both MATLABs are running on the same PC, Case
2: Assuming that they run on different computers on a LAN. I can
think of one possible way, that is that one MATLAB save its workspace
on the disk and then the other one might read it. However, that is
inefficient for realtime highspeed operations. Similarly ferrying
these workspaces using UDPs are inefficient in the given situation.

Question 2. Can there be a trigger event in MATLAB based on the
dynamic value of a variable. Lets say that X = 1 initially. Now based
on the outcome of a seperate procss X = 2 now. Can this changing
value of X trigger a second dormant process to get started. What I
can think of is to add an:

if X ~= 1
   blah
end

at the end of the first process that would let me know if the first
process has changed X. However, that would make the first process
inefficient. Is there a way for MATLAB to recognize that in its
workspace the value of a certain variable has changed and thereby it
doing something about it.

Help!

Subject: Workspace sharing, Trigger events

From: Lars Gregersen

Date: 3 Dec, 2005 10:19:02

Message: 2 of 4

On Sat, 3 Dec 2005 02:54:31 -0500, "Zahid Ullah Khan"
<zahidullah@gmail.com> wrote:

>I got two questions.
>Question 1. Can one MATLAB access the workspace of another MATLAB?
>Case 1: Assuming that both MATLABs are running on the same PC, Case

help memmapfile

>2: Assuming that they run on different computers on a LAN. I can
>think of one possible way, that is that one MATLAB save its workspace
>on the disk and then the other one might read it. However, that is
>inefficient for realtime highspeed operations. Similarly ferrying
>these workspaces using UDPs are inefficient in the given situation.

Matlab is not meant for realtime work. What are your real-time
requirements?

If you need to move data from one computer box to another you need to
do this by some use of the network. Whether you use the file system do
the transfering or you programme the UDP/TCP networking yourself is up
to you. However, since Matlab is singlethreaded you may not be able to
get the performance you need.

I guess you don't need to transfer the entire workspace, but only the
parts that have actually changed.

>Question 2. Can there be a trigger event in MATLAB based on the

No, there are no such triggers in Matlab.


The solution is probably to create a solution using a mix of computer
languages. One for the numerics (Matlab) and one for the transfer and
syncronisation of data (C/C++, Java, etc.)


  Lars

Lars Gregersen
COMSOL A/S
http://www.comsol.dk

Subject: Workspace sharing, Trigger events

From: Stuart McGarrity

Date: 28 Dec, 2005 15:14:22

Message: 3 of 4

You could look at starting MATLABs as automation servers.

http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/f86798.html

Stuart

"Lars Gregersen" <larsg @ comsol . dk> wrote in message
news:nco2p1t7bsrsbv1e4c16q1fp33j6kf8pht@4ax.com...
> On Sat, 3 Dec 2005 02:54:31 -0500, "Zahid Ullah Khan"
> <zahidullah@gmail.com> wrote:
>
>>I got two questions.
>>Question 1. Can one MATLAB access the workspace of another MATLAB?
>>Case 1: Assuming that both MATLABs are running on the same PC, Case
>
> help memmapfile
>
>>2: Assuming that they run on different computers on a LAN. I can
>>think of one possible way, that is that one MATLAB save its workspace
>>on the disk and then the other one might read it. However, that is
>>inefficient for realtime highspeed operations. Similarly ferrying
>>these workspaces using UDPs are inefficient in the given situation.
>
> Matlab is not meant for realtime work. What are your real-time
> requirements?
>
> If you need to move data from one computer box to another you need to
> do this by some use of the network. Whether you use the file system do
> the transfering or you programme the UDP/TCP networking yourself is up
> to you. However, since Matlab is singlethreaded you may not be able to
> get the performance you need.
>
> I guess you don't need to transfer the entire workspace, but only the
> parts that have actually changed.
>
>>Question 2. Can there be a trigger event in MATLAB based on the
>
> No, there are no such triggers in Matlab.
>
>
> The solution is probably to create a solution using a mix of computer
> languages. One for the numerics (Matlab) and one for the transfer and
> syncronisation of data (C/C++, Java, etc.)
>
>
> Lars
>
> Lars Gregersen
> COMSOL A/S
> http://www.comsol.dk

Subject: Workspace sharing, Trigger events

From: Zahid Ullah Khan

Date: 30 Dec, 2005 02:56:51

Message: 4 of 4

Thanks Stuart, I think I can do something with Automation Server. My
requirements are broadly as follows:

Based on the value of an incoming variable (through UDP port) I need
to run an optimization, which then sets a few other variables and
send a reply back to the source (through UDP). The first datastream
is very fast, almost 100 values per second. However, the subsequent
optimization takes a lot more time, and hence the source needs to
wait for a while before it gets feedback. The feedback is
time-critical and affects the system state. If it is delayed, all the
future values from the source (the first datastream) would be biased.

Now, all of this was being done on a MATLAB running on an AMD 64bit
dual-processor machine. My solution was to set another similar
machine that should run the optimization part and then send the
resulting feedback to the source directly. It would have been nice if
somehow I could share the worksapces of these MATLABs, making the
couple faster. The other solution was to break the optimization is
parts and somehow use grid computing (which I don't know!).

I provided details as Lars Gregersen mentioned in his reply that
MATLAB is not meant for real time. It might not be, but it does work
really good in real time! Lars also provided useful hints that really
helped a lot. I wonder if I should program all this in C and then
call it in MATLAB. It might make the optimization faster though I
want something that could make a difference beyond the margin.
>
>
> You could look at starting MATLABs as automation servers.
>
> <http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/f86798.html>
>
> Stuart
>
> "Lars Gregersen" <larsg @ comsol . dk> wrote in message
> news:nco2p1t7bsrsbv1e4c16q1fp33j6kf8pht@4ax.com...
>> On Sat, 3 Dec 2005 02:54:31 -0500, "Zahid Ullah Khan"
>> <zahidullah@gmail.com> wrote:
>>
>>>I got two questions.
>>>Question 1. Can one MATLAB access the workspace of another
> MATLAB?
>>>Case 1: Assuming that both MATLABs are running on the same
PC,
> Case
>>
>> help memmapfile
>>
>>>2: Assuming that they run on different computers on a LAN. I
can
>>>think of one possible way, that is that one MATLAB save its
> workspace
>>>on the disk and then the other one might read it. However,
that
> is
>>>inefficient for realtime highspeed operations. Similarly
ferrying
>>>these workspaces using UDPs are inefficient in the given
> situation.
>>
>> Matlab is not meant for realtime work. What are your real-time
>> requirements?
>>
>> If you need to move data from one computer box to another you
> need to
>> do this by some use of the network. Whether you use the file
> system do
>> the transfering or you programme the UDP/TCP networking
yourself
> is up
>> to you. However, since Matlab is singlethreaded you may not be
> able to
>> get the performance you need.
>>
>> I guess you don't need to transfer the entire workspace, but
only
> the
>> parts that have actually changed.
>>
>>>Question 2. Can there be a trigger event in MATLAB based on
the
>>
>> No, there are no such triggers in Matlab.
>>
>>
>> The solution is probably to create a solution using a mix of
> computer
>> languages. One for the numerics (Matlab) and one for the
transfer
> and
>> syncronisation of data (C/C++, Java, etc.)
>>
>>
>> Lars
>>
>> Lars Gregersen
>> COMSOL A/S
>> <http://www.comsol.dk>
>
>
>

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us