How to access every alternate field of sldvData structure?

1 回表示 (過去 30 日間)
Shoham Mukherjee
Shoham Mukherjee 2020 年 6 月 30 日
コメント済み: Shoham Mukherjee 2020 年 6 月 30 日
I have this structure sldvData..I want to access the fields in an alternate manner using 2 vars..var1 should access slPath, sfObjNum and designSid
var2 should access sfObjType and sid in every iteration inside one loop only. Please help somebody!!!!!

採用された回答

Gaganjyoti Baishya
Gaganjyoti Baishya 2020 年 6 月 30 日
From what I understood from your description is you want to loop over the fields of sldvData struct. And for every iteration you want the current and next field of the sldvData.
fields = fieldnames(sldvData);
for i=1:2:numel(sldvData)
var1 = sldvData.fields{i}; %gives slPath, sfObjNum and designSid
if i+1 <= numel(sldvData)
var2 = sldvData.fields{i+1}; %gives other two
end
end
  1 件のコメント
Shoham Mukherjee
Shoham Mukherjee 2020 年 6 月 30 日
Nicely done! Thanks a lot....

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGenomics and Next Generation Sequencing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by