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?

 採用された回答

Walter Roberson
Walter Roberson 2013 年 10 月 14 日

0 投票

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)));

1 件のコメント

Natalie
Natalie 2013 年 10 月 14 日
Thank you!! Worked perfectly.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeResizing and Reshaping Matrices についてさらに検索

質問済み:

2013 年 10 月 14 日

コメント済み:

2013 年 10 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by