Simplify JSON Decode for Loop
古いコメントを表示
Hi All,
I have some JSON data that I would like to flatten to a table. At the moment I am using a for loop to acheive this, but this is proving to be expensive in terms of time. Is there a way that I can do this without the loop.
Thanks
% This is really inefficient, I need to optimise this.
varNames = signals.tr.header';
varTypes = {'double','double','double','double','cell','double','double'};
t = table('Size',[signals.tr.returnCount 7],'VariableTypes',varTypes,'VariableNames',varNames);
p = cell2table(signals.tr.payload);
for i = 1:signals.tr.returnCount
t1 = p{i,1}{:,:}';
if isequaln(t1{:,6}, t1{:,7}) %if Lat & Long empty
t1{:,6} = nan;
t1{:,7} = nan;
end
t(i,:) = t1;
end
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で JSON Format についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!