How can I call a function to draw histogram in GUI?
2 ビュー (過去 30 日間)
古いコメントを表示
Dear all; I have a function written below, this function supposed to provide me with a histogram, when i push the button it must give a histogram in axes1, how can i do that please? knowing that the gui file and the function are in the same folder:
function SingleAxle = ALS_Single( Class9_data )
directory=dir('*.Y07');
for K = 1 : length(directory)
filename = directory(K).name;
fileID = fopen(filename,'r');
formatSpec = '%s';
A_cell = textscan(fileID,formatSpec);
A=char(A_cell{1,1}{:,:});
A(find(isnan(A)))=0;
[rows,columns]=size(A);
if columns~=105
ArrayTemp=zeros(rows,105);
ArrayTemp(1:rows,1:columns)=A;
A=ArrayTemp;
A=char(A);
A(isspace(A)) = '0';
end
Month_of_Data= A(:,14:15);
M=Class9_data;
figure
SingleAxle=100*Class9_data(:,14);
histogram(SingleAxle);
xlabel('Weight in Kg')
ylabel('Counts')
month(K)=unique(str2num(Month_of_Data));
months = month(K);
title(['ALS for C9 Single For Month ',num2str(months)])
end
0 件のコメント
回答 (1 件)
Steven Lord
2017 年 11 月 15 日
"histogram(ax,___) plots into the axes specified by ax instead of into the current axes (gca). The option ax can precede any of the input argument combinations in the previous syntaxes."
Pass the handle of the axes in the GUI as the first input and your data as the second.
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!