フィルターのクリア

How to display output from edit text gui?

1 回表示 (過去 30 日間)
Tara
Tara 2013 年 5 月 6 日
Hello, i have code bellow
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton26 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
input1=get(handles.edit13,'String');
input2=get(handles.edit14,'String');
input3=get(handles.edit15,'String');
parameter_c=str2num(input1);
gamma=str2num(input2);
probability=str2num(input3);
and also i have a code for libsvm
model = cell(numLabels,1);
for k=1:numLabels
model{k} = svmtrain(double(trainLabel==k), trainData, '-c 1 -g 0.2 -b 1');
end
i want to change the '-c 1 -g 0.2 -b 1' it's something like
model = cell(numLabels,1);
for k=1:numLabels
model{k} = svmtrain(double(trainLabel==k), trainData, '-c parameter_c -g gamma -b probability');
end
but it says ??? Attempt to reference field of non-structure array.
'-c 1 -g 0.2 -b 1' is a string,isn't it? What should i do? thank you
  2 件のコメント
Matt Kindig
Matt Kindig 2013 年 5 月 6 日
編集済み: Matt Kindig 2013 年 5 月 6 日
You intend to use parameter_c, gamma, and probability as variable names, but you are referring to them as literal strings 'parameter_c', 'gamma', and 'probability'. You need to create a string where the values of the variables are substituted in.
Try this line instead:
model{k} = svmtrain(double(trainLabel==k), trainData, sprintf('-c %d -g %f -b %d', parameter_c, gamma, probability) );
Jan
Jan 2013 年 5 月 6 日
@Matt Kindig: I cannot vote for this useful answer, because you have posted it as a comment.

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by