How can I display this plot in a GUI MATLAB?

조회 수: 2 (최근 30일)
Demeter Andreea
Demeter Andreea 2019년 10월 9일
댓글: Walter Roberson 2019년 10월 9일
Hello guys,
I have some problem, when I plot this in a normal script is showing me this: https://imgur.com/rvVB5Dl ( figure 1)
rvVB5Dl.png
And in my GUI its showing me like this: https://imgur.com/bCVIvdQ (figure 2)
bCVIvdQ.png
So I want the result from figure 1 to be displayed in figure 2, not that thing...
This is my code from GUI:
function button2_Callback(hObject, eventdata, handles)
% hObject handle to button2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
global mm
global nn
global pas
global Nr_cuv
mm=str2num(get(handles.edit5,'string'));
setappdata(0,'edit5',mm);
nn=str2num(get(handles.edit6,'string'));
setappdata(0,'edit6',nn);
pas=str2num(get(handles.edit7,'string'));
setappdata(0,'edit7',pas);
Nr_cuv=str2num(get(handles.edit8,'string'));
setappdata(0,'edit8',Nr_cuv);
p_can=mm:pas:nn;%vector cu probab eroare canal
v_er_cuv=zeros(1,length(p_can));
v_er_bit=zeros(1,length(p_can));
for bb=1:length(p_can)
Nr_cuv=0;
cuv_er=0;
bit_er=0;
p=p_can(bb);
for aa=1:Nr_cuv
Vi=randi(100,1,N); % matrice random
Vi=rem(Vi,M2); % matrice finala
Vc=codLin1(Vi,N,C,m,Hc,camp);%apelul functiei de codare liniara; Hc matrici de codare concatenate
Vcer = Gen_er(Vi, Vc, C, p, camp, nrI, nrL, nrRS, m);%
Vdec = decLin(Vcer,Vi,Vc,Hc,C,m,N);
V_cuv=Vi-Vdec;
for tt=1:length(V_cuv)
if V_cuv(tt)>0
V_cuv(tt)=1;
end
end
if sum(V_cuv)
cuv_er=cuv_er+1;
bit_er=bit_er+sum(V_cuv);
end
pe_cuv=cuv_er/Nr_cuv;
pe_bit=bit_er/(Nr_cuv*N);
v_er_cuv(bb)=pe_cuv;
v_er_bit(bb)=pe_bit;
end
%axes(handles.axes1);
plot(p_can,v_er_cuv,'--c*',p_can,v_er_bit,'-bs','LineWidth',2);
ax = gca; %culorile axelor
ax.XColor = '[0.75, 0, 0.75]';
ax.YColor = '[0.75, 0, 0.75]';
grid on;
xlabel('Probabilitatea de eroare pe canal ','FontName','Consolas','FontSize',10,'Fontweight','b');
ylabel('Probabilitatea de eroare la iesire ','FontName','Consolas','FontSize',10,'Fontweight','b');
legend({'Probabilitatea de eroare pe cuvinte','Probabilitatea de eroare pe biti'},'Location','northeast');
end
In a normal script I just plot this: plot(p_can,v_er_cuv,'--c*',p_can,v_er_bit,'-bs','LineWidth',2); and its showing me like I want but in GUI not...
What can I do ? Please help!

답변 (0개)

카테고리

Help CenterFile Exchange에서 Graphics Objects에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by