Question about writing a function.

1 回表示 (過去 30 日間)
Ongun Palaoglu
Ongun Palaoglu 2020 年 9 月 21 日
コメント済み: Ongun Palaoglu 2020 年 9 月 22 日
Hello, I am trying to write my first function. i have couple of calculations in it and then plot.
my input variable is x, x will be a data set it will be a column.
how can I put name of x on plot labels. in this case for example Bmi
histogram(x)
xlabel('frequency of'+ x)
%it is not correct what is the correct syntax? i want it to be name ofthe column in my data set
I also want to add properties for my function. for example In mean function we can write mean(x,'all')
myfunction(x,'do only this')
as my last question i googled i couldnt find an answer that i understand. in matlab app creating, how can you import your data set in workspace into appdesigner

採用された回答

the cyclist
the cyclist 2020 年 9 月 21 日
編集済み: the cyclist 2020 年 9 月 21 日
In the future, you might want to separate two such different questions as two different posts here.
For your first question, why not just write
xlabel('frequency of x')
For your second question, you could do something like this:
function [] = answerTest(x,doit)
if exist('doit','var')
if strcmp(doit,'do only this')
disp('I''m going to do only this')
else
disp('do something else')
end
else
disp('did you forget to tell me what to do?')
end
end
  1 件のコメント
Ongun Palaoglu
Ongun Palaoglu 2020 年 9 月 22 日
Thank you very much for your answer. Next time i will open one topic to one question, ty for your feedback.

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

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by