First, thanks for this code. It's really nice to have a toolbox like k-Wave!

I was wondering if there's a way of having kWave save a full snapshot of the acoustic field at predefined times (say, you run for t=linspace(0,1e-3,1000); and you want snapshots for tSnapshot=linspace(0,1e-3,10)). These snapshots would be full pictures of the pressure field, as if there were sensors everywhere.

An example with the field filled up with sensors would be something like shown below; but as the code is below it does not skip any time step. This is not great for memory purposes, if the simulation is very long. Right now I'm making do with this, but I wonder if k-wave has something better!

%================

Nx = 128; % number of grid points in the x (row) direction

Ny = 128; % number of grid points in the y (column) direction

dx = 1e-3; % grid point spacing in the x direction [m]

dy = 1e-3; % grid point spacing in the y direction [m]

t=linspace(0,1e-3,1000);

kgrid = kWaveGrid(Nx, dx, Ny, dy);

kgrid.t_array=t;

% define the properties of the propagation medium

medium.sound_speed = 343; % [m/s]

medium.alpha_coeff = 0.75; % [dB/(MHz^y cm)]

medium.alpha_power = 1.5;

medium.density = 1.2 * ones(Nx, Ny);

% define a single source point

source.p_mask = zeros(Nx, Ny);

source.p_mask(end - Nx/4, Ny/2) = 1;

% define a time varying sinusoidal source

source_freq = 10e3; % [Hz]

source_mag = 10; % [Pa]

source.p = source_mag * sin(2 * pi * source_freq * t);

sensor.mask=ones(Nx, Ny);

sensor_data = kspaceFirstOrder2D(kgrid, medium, source, sensor);

sensor_data=reshape(sensor_data,size(sensor.mask,1),size(sensor.mask,2),length(t));

%Plots the simulation

figure;

for i=1:length(t)

imagesc(sensor_data(:,:,i), [-1, 1]);

colormap(getColorMap);

drawnow;pause(0.01)

end

%=======