vendredi 2 juillet 2021

split vector between spaces

I would like to create many matrices from a very large matrix.

These are the first lines of my matrix:

'G02'   90.1588000000000    39.7869000000000    -0.779400000000000  48.0830000000000    0.288600000000000   -0.401300000000000  0.869300000000000   1   0   0
'G06'   51.7090000000000    27.4101000000000    -0.157700000000000  41.9090000000000    -0.0824000000000000 -0.644000000000000  0.760600000000000   1   0   0
'G12'   76.2320000000000    64.5575000000000    -0.447700000000000  49.6050000000000    -0.103700000000000  -0.114200000000000  0.988000000000000   1   0   0
'G24'   152.686400000000    23.2464000000000    -0.326100000000000  39.5560000000000    0.0974000000000000  -0.294700000000000  -0.950600000000000  1   0   0
'G25'   290.170000000000    72.0137000000000    -0.606600000000000  50.6370000000000    -0.402300000000000  -0.883400000000000  0.240500000000000   1   0   0
'G29'   212.636100000000    34.8263000000000    0.856500000000000   42.1420000000000    -0.527200000000000  0.807200000000000   -0.265600000000000  1   0   0
'G31'   310.781800000000    16.6067000000000    -0.529700000000000  42.5590000000000    0.605400000000000   -0.145500000000000  -0.782500000000000  1   0   0
'G32'   260.873900000000    30.0225000000000    -0.317500000000000  47.5850000000000    -0.175100000000000  -0.0214000000000000 -0.984300000000000  1   0   0
'E01'   287.527800000000    43.4138000000000    -0.927900000000000  45.7400000000000    0.0607000000000000  -0.840500000000000  -0.538400000000000  0   1   0
'E04'   282.355100000000    24.3599000000000    0.920300000000000   44.7190000000000    0.662600000000000   -0.271000000000000  -0.698200000000000  0   1   0
'E09'   333.562800000000    10.4773000000000    -0.200600000000000  39.7450000000000    -0.421300000000000  -0.260600000000000  -0.868700000000000  0   1   0
'E13'   120.905800000000    46.3507000000000    0.00740000000000000 47.4610000000000    -0.0326000000000000 -0.714900000000000  0.698400000000000   0   1   0
'E15'   51.1470000000000    32.7178000000000    0.458600000000000   44.5280000000000    0.169000000000000   0.205000000000000   0.964100000000000   0   1   0
'E21'   67.3130000000000    81.0821000000000    -0.193600000000000  49.0010000000000    -0.189200000000000  -0.803700000000000  -0.564100000000000  0   1   0
'E27'   99.0631000000000    27.8179000000000    0.901000000000000   43.2740000000000    -0.0922000000000000 0.892900000000000   0.440700000000000   0   1   0
'C08'   55.3331000000000    31.7218000000000    0.550400000000000   39.6130000000000    0.331700000000000   -0.894000000000000  0.301100000000000   0   0   1
'C13'   81.4891000000000    33.6572000000000    0.426300000000000   42.5610000000000    -0.609900000000000  0.118800000000000   0.783500000000000   0   0   1
'C24'   300.310900000000    21.5646000000000    -0.0396000000000000 43.9920000000000    -0.259300000000000  0.872700000000000   0.413700000000000   0   0   1
'C26'   287.284100000000    70.3941000000000    1.01310000000000    51.9550000000000    -0.0491000000000000 -0.283400000000000  0.957700000000000   0   0   1
'C29'   71.5661000000000    54.1001000000000    -0.201600000000000  49.7620000000000    0.593100000000000   -0.490000000000000  -0.638900000000000  0   0   1
'C35'   174.458700000000    53.0327000000000    0.738000000000000   40.8490000000000    -0.0932000000000000 0.926100000000000   0.365700000000000   0   0   1
''  NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN
'G02'   90.1494000000000    39.7889000000000    -0.681700000000000  47.9940000000000    0.285800000000000   -0.405400000000000  0.868300000000000   1   0   0
'G06'   51.7016000000000    27.4076000000000    -0.122200000000000  42.0400000000000    -0.0869000000000000 -0.641500000000000  0.762200000000000   1   0   0
'G12'   76.2398000000000    64.5503000000000    -0.525900000000000  49.5880000000000    -0.0980000000000000 -0.109700000000000  0.989100000000000   1   0   0
'G24'   152.687900000000    23.2392000000000    -0.524800000000000  40.0120000000000    0.100000000000000   -0.301000000000000  -0.948400000000000  1   0   0
'G25'   290.180200000000    72.0211000000000    -0.619200000000000  50.6890000000000    -0.393900000000000  -0.889000000000000  0.233400000000000   1   0   0
'G29'   212.638700000000    34.8340000000000    0.645800000000000   42.0450000000000    -0.528200000000000  0.804100000000000   -0.273000000000000  1   0   0
'G31'   310.781700000000    16.6134000000000    -0.519800000000000  42.4060000000000    0.600200000000000   -0.144300000000000  -0.786700000000000  1   0   0
'G32'   260.866300000000    30.0185000000000    -0.340800000000000  47.4520000000000    -0.171400000000000  -0.0196000000000000 -0.985000000000000  1   0   0
'E01'   287.531300000000    43.4192000000000    -0.885600000000000  45.8130000000000    0.0638000000000000  -0.843200000000000  -0.533800000000000  0   1   0
'E04'   282.349200000000    24.3574000000000    1.00080000000000    44.7670000000000    0.659400000000000   -0.274300000000000  -0.700000000000000  0   1   0
'E09'   333.558300000000    10.4796000000000    -0.377100000000000  39.7210000000000    -0.420800000000000  -0.257700000000000  -0.869800000000000  0   1   0
'E13'   120.899000000000    46.3556000000000    0.0345000000000000  47.5420000000000    -0.0376000000000000 -0.718100000000000  0.694900000000000   0   1   0
'E15'   51.1413000000000    32.7148000000000    0.365800000000000   44.4790000000000    0.172000000000000   0.206300000000000   0.963300000000000   0   1   0
'E21'   67.3416000000000    81.0778000000000    -0.190300000000000  48.9070000000000    -0.165700000000000  -0.806400000000000  -0.567600000000000  0   1   0
'E27'   99.0675000000000    27.8129000000000    0.891400000000000   43.1130000000000    -0.0959000000000000 0.890300000000000   0.445200000000000   0   1   0
'C08'   55.3300000000000    31.7230000000000    0.346100000000000   39.5560000000000    0.328800000000000   -0.894700000000000  0.302300000000000   0   0   1
'C13'   81.4865000000000    33.6600000000000    0.343100000000000   42.3540000000000    -0.611700000000000  0.120800000000000   0.781800000000000   0   0   1
'C24'   300.312400000000    21.5706000000000    -0.102200000000000  44.0780000000000    -0.261300000000000  0.874700000000000   0.408300000000000   0   0   1
'C26'   287.275600000000    70.4003000000000    1.07280000000000    51.9090000000000    -0.0505000000000000 -0.277100000000000  0.959500000000000   0   0   1
'C29'   71.5566000000000    54.0962000000000    -0.265400000000000  49.7060000000000    0.590300000000000   -0.497200000000000  -0.635900000000000  0   0   1
'C35'   174.456000000000    53.0401000000000    0.686700000000000   40.8300000000000    -0.0910000000000000 0.929000000000000   0.358800000000000   0   0   1
''  NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN

The NaN-values are always under each row.

I used detectImportOptions to get my csv.file into Matlab.

Then I would like develop a code to divide this matrix into many individual epochs, which always go from the 1st value to NaN (then the next value after NaN to the next NaN etc.).

Can I somehow specify that NaN or another value such as 99999999 is always the limit line for an epoch?

And can I then use if loops to do my calculations with each individual epoch and at the end get a standard deviation for each one, for example, which is output? So then for the 1st epoch the standard deviation1, the 2nd epoch standard deviation2, and so on.

Thank you very much!

Aucun commentaire:

Enregistrer un commentaire