選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

50 行
1.4KB

  1. classdef Oscilloscope < Equipment
  2. %OSCILLOSCOPE Summary of this class goes here
  3. % Detailed explanation goes here
  4. properties
  5. nchannels
  6. horizontalPosition
  7. timescale
  8. ch1
  9. ch2
  10. ch3
  11. ch4
  12. trigger
  13. acquisition
  14. end
  15. methods
  16. function sc = Oscilloscope(ipAddress,port,nchannels)
  17. %OSCILLOSCOPE Construct an instance of this class
  18. % Detailed explanation goes here
  19. sc@Equipment(ipAddress,port,-1);
  20. sc.trigger = Trigger(sc);
  21. for i = 1:nchannels
  22. sc.(['ch',num2str(i)]) = Channel(sc,i);
  23. end
  24. end
  25. function data = waveform(ch,cha)
  26. ch.scope.clear;
  27. ch.scope.write('CHAN1:TYPE HRES');
  28. ch.scope.write('FORM REAL');
  29. ch.scope.write('FORM:BORD MSBF');
  30. ch.scope.write('CHAN1:DATA:POIN DEF');
  31. ch.scope.write('SING');
  32. header = str2num(ch.scope.query('CHAN1:DATA:HEAD?'));
  33. ch.scope.write_unsafe('CHAN1:DATA?');
  34. prefixstring = fscanf(ch.scope.tcp,'%c',2);
  35. prefixlength = str2double(prefixstring(2));
  36. datalength = fscanf(ch.scope.tcp,'%c',prefixlength);
  37. data = fread(ch.scope.tcp,header(3),'float');
  38. flushinput(ch.scope.tcp);
  39. end
  40. end
  41. end