dynamic subindices <-> linear indices conversion, data crop /trim
Mostrar comentarios más antiguos
Is there a way to dynamically crop N-dimensional data into an N-1 set? I have no knowledge of N before runtime, nor of the dimension on which to crop.
I need to write a 'trimming' function of the form:
>> data_NDm1 = one_dim_trim(ndata, 1, x);
% which will allow me to replace any of the
>> data_NDm1 = data_ND(x,:);
>> data_NDm1 = data_ND(x,:,...,:);
% or replace
>> data_NDm1 = ndata(:,x,:,...,:);% with
>> data_NDm1 = one_dim_trim(ndata, 2, x);
I have already written a 'cropping' function like
>> data_1D = one_dim_crop(ndata, [3, NaN, 4, 7]);
% which takes variable size arguments and replaces:
>> data_1D = ndata(3, :, 4, 7);
...but I'm kind of stuck here :-)
Any hints would be greatly appreciated.
1 comentario
tudor dima
el 27 de Abr. de 2018
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!