Skip to content

Commit

Permalink
Take into account :WAVEFORM:YREF? when scaling/shifting data
Browse files Browse the repository at this point in the history
This fixes a bug wherein retrieved data has the wrong vertical offset.
  • Loading branch information
nsdecicco committed Sep 18, 2017
1 parent ead0a7a commit 037b044
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion getscopedat.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
%Acquire Y origin and Y increment Values
yorg = str2double(query(eval(obj_name),':WAVEFORM:YOR?'));
yinc = str2double(query(eval(obj_name),':WAVEFORM:YINC?'));
yref = str2double(query(eval(obj_name),':WAVEFORM:YREF?'));

%Setup the Scope for proper output format
fprintf(eval(obj_name), 'WAVEFORM:FORMAT BYTE');
Expand All @@ -120,7 +121,7 @@

%Adjust data and time variables with x/y increments/origins
t = t1 * xinc + xorg;
data = data1 * yinc + yorg;
data = (data1-yref) * yinc + yorg;

plot(t,data);

Expand Down
3 changes: 2 additions & 1 deletion usbgetscopedat.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
%Acquire Y origin and Y increment Values
yorg = str2double(query(eval(obj_name),':WAVEFORM:YOR?'));
yinc = str2double(query(eval(obj_name),':WAVEFORM:YINC?'));
yref = str2double(query(eval(obj_name),':WAVEFORM:YREF?'));

%Setup the Scope for proper output format
fprintf(eval(obj_name), 'WAVEFORM:FORMAT BYTE');
Expand All @@ -120,7 +121,7 @@

%Adjust data and time variables with x/y increments/origins
t = t1 * xinc + xorg;
data = data1 * yinc + yorg;
data = (data1-yref) * yinc + yorg;

plot(t,data);

Expand Down

0 comments on commit 037b044

Please sign in to comment.