Prev: MATLAB GA
Next: Yield strength
From: dfgdg dfgdfg on 28 Jul 2010 06:58 I want to use "set_param" in my GUI.But everytime I got some errors.My codes; -------------------------------- m=str2num(handles.edit2,'String')); %Get value as a number from editbox set_param('MH1/Signal Generator', 'Amplitude',m);%Change the amplitude -------------------------------- It didn't work.Then I tried; set_param('MH1/Signal Generator', 'Amplitude','5'); It has worked.But I want to use a variable to change the amplitude of signal generator.How can I do this? Thanks.
From: Steven_Lord on 28 Jul 2010 09:22 "dfgdg dfgdfg" <sakirae(a)gmail.com> wrote in message news:i2p2fs$5j1$1(a)fred.mathworks.com... > I want to use "set_param" in my GUI.But everytime I got some errors.My > codes; > -------------------------------- > m=str2num(handles.edit2,'String')); %Get value as a number from editbox > set_param('MH1/Signal Generator', 'Amplitude',m);%Change the amplitude > -------------------------------- > It didn't work. Not enough information. What SPECIFICALLY do you mean by "It didn't work" -- did you receive a warning? An error? A different answer from what you expected? >Then I tried; > set_param('MH1/Signal Generator', 'Amplitude','5'); > It has worked.But I want to use a variable to change the amplitude of > signal generator.How can I do this? Assuming that you receive from STR2NUM a value that's a valid Amplitude for the Signal Generator block, what you posted should do. Since it didn't, there's really nothing we can do until or unless you post additional information about what happened. [Post it to the newsgroup, please, rather than sending it to me directly. I am going to be out of the office for a few days, and I wouldn't have a chance to look at it before I leave.] -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
From: Nevine on 28 Jul 2010 10:02 Several block parameter values must be specified as strings. So in your case, you could do the following: m=str2num(handles.edit2,'String')); %Get value as a number from editbox set_param('MH1/Signal Generator', 'Amplitude',num2str(m)); Hope that helps. "dfgdg dfgdfg" <sakirae(a)gmail.com> wrote in message <i2p2fs$5j1$1(a)fred.mathworks.com>... > I want to use "set_param" in my GUI.But everytime I got some errors.My codes; > -------------------------------- > m=str2num(handles.edit2,'String')); %Get value as a number from editbox > set_param('MH1/Signal Generator', 'Amplitude',m);%Change the amplitude > -------------------------------- > It didn't work.Then I tried; > set_param('MH1/Signal Generator', 'Amplitude','5'); > It has worked.But I want to use a variable to change the amplitude of signal generator.How can I do this? > Thanks.
|
Pages: 1 Prev: MATLAB GA Next: Yield strength |