"ServerID must be a string" problem

조회 수: 1 (최근 30일)
Nikolay Panasetsky
Nikolay Panasetsky 2015년 11월 30일
댓글: Nikolay Panasetsky 2015년 11월 30일
I can not read the data from the dialogue box to connect the OPC server. The error occurs: "ServerID must be a string"
Here's the code:
function Newhost_Callback(hObject, eventdata, handles)
prompt = {'Host name:'};
dlg_title = 'Input';
num_lines = 1;
defaultans = {'Matrikon.OPC.Simulation.1'};
answer = inputdlg(prompt,dlg_title,num_lines,defaultans);
da = opcda('localhost', answer);
connect(da);

채택된 답변

Walter Roberson
Walter Roberson 2015년 11월 30일
inputdlg() always returns a cell array, not a single string.
da = opcda('localhost', answer{1});

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Server Connection and Browsing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by