我想到了!我认为。花几个星期后退一步,刷新真的很有帮助。这是我所做的:
1) 编辑驱动程序init
函数以配置更大的缓冲区大小。完整init
代码:
function init(obj)
% This method is called after the object is created.
% OBJ is the device object.
% End of function definition - DO NOT EDIT
% Extract the interface object.
interface = get(obj, 'Interface');
fclose(interface);
% Configure the buffer size to allow for waveform transfer.
set(interface, 'InputBufferSize', 12e6);
set(interface, 'OutputBufferSize', 12e6); % Originally is set to 50,000
我最初尝试将缓冲区大小设置为 22e6(我想获得 1000 万个点),但出现内存不足错误。假设缓冲区应该是您期望的两倍多一点,加上标题的空间。我可能不需要价值 200 万点的“标题”,但是,嗯。
2)编辑驱动程序readwaveform()
,首先查询用户可设置的收集点数应该是多少。然后,将 SCPI 命令写入示波器,以确保要传输的数据点数等于用户所需的点数。下面的代码片段可以解决问题readwaveform
:
try
% Specify source
fprintf(interface,['DATA:SOURCE ' trueSource]);
%----------BEGIN CODE TO HANDLE MORE THAN 10k POINTS----------
recordLength = query(interface, 'HORizontal:RECordlength?');
fprintf(interface, 'DATA:START 1');
fprintf(interface, 'DATA:STOP %d', str2num(recordLength));
%----------END CODE TO HANDLE MORE THAN 10k POINTS----------
% Issue the curve transfer command.
fprintf(interface, 'CURVE?');
raw = binblockread(interface, 'int16');
% Tektronix scopes send and extra terminator after the binblock.
fread(interface, 1);
3) 在用户代码中,设置 SCPI 命令以将记录大小更改为底层接口对象:
% interfaceObj is a VISA object.
fprintf(interfaceObj, 'HORizontal:RECordlength 5000000');
你有它。希望这可以帮助其他试图解决这个问题的人。