"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});
  1 件のコメント
Nikolay Panasetsky
Nikolay Panasetsky 2015 年 11 月 30 日
Thank you)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeServer Connection and Browsing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by