项目作者: brtiberio

项目描述 :
Example of java class semaphore inside matlab
高级语言: Matlab
项目地址: git://github.com/brtiberio/semaphores-matlab-example.git
创建时间: 2016-11-11T11:25:00Z
项目社区:https://github.com/brtiberio/semaphores-matlab-example

开源协议:GNU General Public License v2.0

下载


semaphores-matlab-example

This is just an example how to use the java semaphore class in Matlab.
Includes .m file and respective .fig necessary for running the example.
Matlab is build on top of java so the ideia is to take advantage of that and use functions already on java core. Read more about it here

How to use

Run the GUI provided and hit run.

This will trigger a update function attached to a timer who will print rand() number.

Press Hold

The semaphore will prevent the update function for three seconds After will release it and update can again print random numbers

Hit Stop

stops the timer. You can close the figure now

The basics behind it

first we need to tell Matlab we want to use that class:

  1. import java.util.concurrent.Semaphore;

After we can use the class methods as typically:

  1. mutex = Semaphore(1);
  2. mutex.availablePermits

all information about the java class is here