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!