Brad and Ben,
A small issue has popped up as I have done a little modeling of linear arrays. Depending on my selected grid interval and size of the sensor elements, I get a fatal error:
Subscripted assignment dimension mismatch.
Error in kspaceFirstOrder_inputChecking (line 227)
sensor.time_reversal_boundary_data(:, new_col_pos) =
order_index;
Error in kspaceFirstOrder2D (line 427)
kspaceFirstOrder_inputChecking; ...
I modified makeCartCircle to generate the Cartesian coordinates of a line of sensor elements. Generally, the elements are quite small. If I choose a dx of 0.044 mm and 9 points per sensor (with two points as spaces), I do not get an error. If I choose dx to be 0.067 mm and 6 points per sensor, I do get this error.
I have traced the problem to Cart2grid.m
. Looking at the array data_x
which holds the Cartesian x-value, I see that it can contain 1 or more duplicate values as a result of the rounding function. Since data_y
values are constant (the array was oriented vertically), this put duplicate points into the same position in grid_data
, losing the first point. Now the arrays become mismatched. In the past, I have used this code for circular arrays without a problem, but the probability of both the x- and y-coordinates rounding to the same grid point as a previous point is much smaller.
Relevant code in Cart2grid
:
% scale position values to grid centered pixel coordinates using nearest
% neighbour interpolation
data_x = round(data_x./kgrid.dx);
data_y = round(data_y./kgrid.dy);
% shift pixel coordinates to coincide with matrix indexing
data_x = data_x + floor(kgrid.Nx/2) + 1;
data_y = data_y + floor(kgrid.Ny/2) + 1;
% map values
for data_index = 1:length(data_x)
grid_data(data_x(data_index), data_y(data_index)) = point_index(data_index);
end
I can work around this by judiciously choosing my grid size. Or I can probably reduce the chances of it happening by putting my sensors at an angle. So it is not big issue.
Regards,
Dan