Plotting Data by Using Loaded TXT File and Gui Pushbutton Problem

2 views (last 30 days)
Dear, everyone. I have a problem with my Gui Pushbutton Script to plt my loaded txt data here... This is my script :
function pushbutton11_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
formku = guidata(gcbo);
[namafile,direktori]=uigetfile('*.txt','Load Data Magnet LEMI RAW','Multiselect','on');
eval(['cd ''' direktori ''';']);
eval(['mydata=load(''' namafile ''')']);
tahun = mydata(:,1); %: Getting data in column 1
bulan = mydata(:,2); %: Getting data in column 2
tanggal = mydata(:,3); %: Getting data in column 3
jam = mydata(:,4); %: Getting data in column 4
menit = mydata(:,5); %: Getting data in column 5
detik = mydata(:,6); %: Getting data in column 6
kompx = mydata(:,7); %: Getting data in column 7
kompy = mydata(:,8); %: Getting data in column 8
kompz = mydata(:,9); %: Getting data in column 9
w = seconds((3600*jam)+(60*menit)+ detik);
w.Format = 'hh:mm';
D = datetime(tahun,bulan,tanggal,jam,menit,detik,'TimeZone','Asia/Jakarta');
s = (w/86400)+tanggal;
for i=1:length(detik)
hmagnet = sqrt((kompx.^2)+(kompy.^2));
fmagnet = sqrt((kompx.^2)+(kompy.^2)+(kompz.^2));
p = plot(D, hmagnet);
xlabel('Time Series','fontweight','bold','fontsize',10);
ylabel('Horizontal Magnetic Component Of Non IAGA Lemi Format (nT)','fontweight','bold','fontsize',10);
set(formku.satu,'Color',[1 0.96 0.9],...
grid on
I just want to get the desired column data to be calculated by using Pythagoras formula as hmagnet or fmagnet data column and then plotting the result versus TIME data in D variable on my GUI .fig program but it never happened.
It just show me as a blank cartesian default figure.... So everyone, im so grateful if you help my problem here... Thank you very much...
Rik on 8 Jul 2021
One minor addition: the handles struct is already loaded, so your first line is not required.
I guessed your language by pasting your comments in Google translate.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!