Retrieve data from column plus x

I have a large set of data that contains information about numerous different core samples. Each core sample has a different amount of sections, the amount of sections for each specific core is stipulated in column 13. I need to find out the length of each core sample, this information is provided in the final section length. So if the value in column 13 was 6, the length of the core would be found in column 19. As each core has different amount of sections how would I extract information regarding the length of each individual core?

 Respuesta aceptada

Walter Roberson
Walter Roberson el 14 de Oct. de 2013
final_len_col = 13 + coredata(:,13);
final_len_idx = sub2idx(size(coredata), 1:size(coredata,1), final_len_col);
final_lengths = coredata(final_len_idx);
This can be abbreviated
final_lengths = coredata((1:size(coredata,1)).' + size(coredata,1) * ((13-1) + coredata(:,13)));

Más respuestas (0)

Categorías

Preguntada:

el 14 de Oct. de 2013

Comentada:

el 14 de Oct. de 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by