Interfacing Simulink and OPC throws a well known error: "In an assignment A(:) = B, the number of elements in A and B must be the same"

2 visualizzazioni (ultimi 30 giorni)
Hi! I'm using OPC DA to connect a simulator to a simple Simulink model. The Simulink model is used to write to and read from a list of tags within the simulator environment.
Upon pressing "Run" in the Simulink environment, the diagnostic imidiately throws the following error: "Error evaluating registered method 'Start' of MATLAB S-Function 'opcslread' in 'OPC_2x4_testing_alle_variable/OPC Read'. The following is the MATLAB call stack (file names and line numbers) that produced this error: ['C:\Appl\Matlab2015b\Installert\toolbox\opc\opcblks\opcblks\opcslread.p'] [0] Caused by: In an assignment A(:) = B, the number of elements in A and B must be the same."
While I do recognise the error, I don't know how to solve it in this particular case. Another strange thing is that the error is not strictly consistent. Hence, in some cases(without altering anything) pressing run works fine and the interface works. After a successful run, trying to repeat the previous run with exactly the same data throws the error again.
Since the error origins from the OPC read block which provides values directly from the Simulator, the data I try to write to it does not cause the error, I presume. Even, I have, just in case, checked the write data which seems fine.
Anyone who can help me out here? Much appreciated!

Risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by