how to skip and split specific range of rows in to multiple columns ?

4 ビュー (過去 30 日間)
I have long data like thais in one colmun
0.00248
0.00310
0.00377
0.00459
0.00558
120
0
0
NaN
0.002480
0.003100
0.003770
0.004590
0.005580
I want to read first 5 rows in first colmun and skip the next 4 rows and read next five rows as second colmun.
like that I want to do for entire my long colmun data.
How can I do that ?
  1 件のコメント
Stijn Haenen
Stijn Haenen 2020 年 5 月 17 日
somthing like this:
new_list=[];
for i=1:9:numel(data)
new_list(1:5,end+1)=data(i:i+4);
end

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

採用された回答

Walter Roberson
Walter Roberson 2020 年 5 月 17 日
D = load('YourFile.txt');
N = length(D);
R = mod(N,9);
if R ~= 0
D(end+1:end+9-R) = nan;
end
Dcols = reshape(D, 9, []);
Dcols(6:end,:) = [];
  1 件のコメント
Jeevan Kumar Bodaballa
Jeevan Kumar Bodaballa 2020 年 5 月 17 日
Great this is working so perfect.
Thanks a lot :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeTables についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by