%% Returns column of indices in the slowness vector corresponding to selected %% rows and columns in the spatial grid %% ====================================================================================== %% %% Parameters: %% model - structure describing the 2D rectangular model. %% rows - one or multiple numbers of rows (depth levels) in the grid %% cols - one or multiple numbers of columns (horizontal distances) in the grid %% Returns: %% ind - indices of rows in the slowness model vector corresponding to (rows,cols) function ind = grid_block(model,rows,cols) ind = []; nr = length(rows); nc = length(cols); rcol = reshape(cols,nc,1); % list of column numbers as a column for i=1:nr ind = [ ind; ones(nr,1)*(rows(i)-1)*model.nx + rcol ]; end end