I am creating a user interface and want to output a vector using the push button function

2 ビュー (過去 30 日間)
I am creating a user interface and want to output a vector using the push button function. i have written this code so far the push button but am getting error messages and not sure how to fix it.
the code ive used is:
theta = app.ThetaSlider;
w_s= app.spinAVSpinner;
w_n = app.NutationAVSpinner;
w_p = app.PrecessionAVSpinner;
wi = [(-w_n*theta*0) 0 0];
wj = [0 w_s*sind(theta) 0];
wk = [ 0 0 (w_p + w_s*cosd(theta))];
W = wi + wj + wk;
app.WEditField.Value = W;
The Result im trying to produce is: -3.0000 8.6603 10.0000
  4 件のコメント
Thomas Fournier
Thomas Fournier 2021 年 8 月 12 日
編集済み: Thomas Fournier 2021 年 8 月 12 日
You can display vector in a edit fiel(text) by doing :
app.EditField.Value=num2str([4,2,5])
rahim njie
rahim njie 2021 年 8 月 12 日
ok thanks however, when i run the code i keep getting error code referring to my use of 'sind' saying it is an undefined function. i need to use sind(theta) to output the correct results. Do you know how to solve this problem

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

採用された回答

Dave B
Dave B 2021 年 8 月 12 日
Your line of code
theta = app.ThetaSlider;
Says that theta should be the slider object. MATLAB is complaining because it doesn't know how to take the sine of a slider. I think you probably want to take the sine of the slider's value, which is as simple as
theta = app.ThetaSlider.Value;

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by