Load txt file and split into the matrix
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
hello i have a txt file that i want to load and then it makes me 139x2 matrix then I chose data what i want and i makes me 121x1 matrix
clear all;
A=readtable('_cl_data_draha_nastroje2.txt')
B=A(19:139,2)
{'-9.4925,78.2355,49.0974,-0.5710247,0.7637159,0.3011125' }
{'-10.1414,78.2525,48.7282,-0.5694185,0.7634438,0.3048215' }
{'-10.7290,78.2728,48.3698,-0.5677140,0.7632457,0.3084751' }
{'-11.5366,78.3085,47.8449,-0.5650385,0.7630117,0.3139182' }
{'-12.2915,78.3486,47.3231,-0.5622776,0.7627737,0.3194060' }
{'-13.0160,78.3952,46.7976,-0.5595119,0.7624675,0.3249458' }
{'-13.7227,78.4474,46.2607,-0.5567769,0.7620374,0.3306032' }
{'-14.4119,78.5063,45.7151,-0.5541024,0.7614721,0.3363493' }
{'-15.0816,78.5713,45.1651,-0.5514732,0.7607848,0.3421750' }
{'-15.7296,78.6410,44.6150,-0.5488955,0.7599623,0.3480964' }
{'-16.3575,78.7147,44.0686,-0.5463235,0.7590584,0.3540636' }
{'-16.9692,78.7914,43.5245,-0.5437513,0.7580590,0.3601127' }
{'-17.5673,78.8709,42.9845,-0.5411592,0.7569990,0.3661956' }
{'-18.7357,79.0367,41.9120,-0.5359051,0.7546881,0.3784859' }
this is a part of B matrix and i have six values on each row and i would like to make two C and D 121x3 matrix
that will look like this C=[-9.4925, 78.2355, 49.0974; -10.1414,78, etc]
D=[-0.5710247, 0.7637159, ,0.3011125;-0.5694185, etc]
I would be glad for any help, thank you
1 Kommentar
Antworten (1)
Chunru
am 4 Sep. 2021
B = {'-9.4925,78.2355,49.0974,-0.5710247,0.7637159,0.3011125'
'-10.1414,78.2525,48.7282,-0.5694185,0.7634438,0.3048215'
'-10.7290,78.2728,48.3698,-0.5677140,0.7632457,0.3084751'
'-11.5366,78.3085,47.8449,-0.5650385,0.7630117,0.3139182'
'-12.2915,78.3486,47.3231,-0.5622776,0.7627737,0.3194060' } ; % part of original B
B = str2double(split(string(B), ','))
C = B(:, 1:3)
D = B(:, 4:6)
0 Kommentare
Siehe auch
Kategorien
Mehr zu Characters and Strings finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!