File Exchange

image thumbnail

OPC Server/Client Demo

version 1.1 (9.7 KB) by

OPC toolbox and Kepserver (Server/Client Program)



View License

For this program to run, you will need to download Kepserver found at
After you have download and installed the KepServer, use the demo.opf file included in the as the default project in Kepserver.
Then run the opc_demo.m file, you will see how Matlab as an OPC Client communicates with this OPC server.
You can try different servers as well, such as Matrikon, Iconics, etc, but you will have to create your own server configuration files.
Next you can try connecting any PLC which are supported by Kepserver and try out PLC communication through Matlab.
There is also an inbuilt OPC Client in Kepserver which will reflect the same results as on this program.

The boolean output i.e the RED/GREEN toggle button o/p can be viewed on the OPC Client of Kepserver

Comments and Ratings (3)

sinan turgut

Radu Mihai

Hi, thanks a lot for posting this app!

I'm a student and my assignment is to create a simple OPC client/server application. So your example is great to make my own program from, but I have a problem with it, I figured you're the best person to ask, since you created it. I have kepserver running, and at runtime (clicking the cylinder button) matlab gives this error:

??? Reference to non-existent field 'data_itm'.

Error in ==> opc_demo>cylinder_Callback at 325
state = read(handles.data_itm(state));

Error in ==> gui_mainfcn at 96

Error in ==> opc_demo at 42
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback

The error is similar for the ejector device, kepserver fails to add any of the devices:

Date Time Level User Name Source Event
12/27/2010 6:59:11 PM 2 Default User KEPServerEx Attempt to add OPC client item 'Channel_0.Sine.Sine1' failed.

Could you please help me with this? Meanwhile, I'm continuing to search for solutions.

Ngo Huy

Hi everybody ! My name Ngo Huy . i am studient four year of Ho Chi Minh University of industry . I have a project graduated processor image (Product Classification in (closed chain stoppers)
help me . i use PLC s7200 , matlab 7.1



updated file

MATLAB Release
MATLAB 7.3 (R2006b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video