converting string to num and table
I have a table containing string data that represents cyclone certain and uncertain tracks. Each cell in the table may contain multiple track numbers (seperated by a space), where the presence of ‘x’ beside a number indicates uncertainty in that track. For example, in tempData(7,1) = "30 25x", ’30’ is a certain track, and ’25’ is uncertain.
I need to write a code that parses each cell in a column of tempData, separates the track numbers and their uncertainty markers (‘x’), and outputs a (in this case) 4-column table for each column in tempData. The headers of the output table should be track1, uncert1, track2, uncert2, corresponding to the parsed tracks and their certainty indicators (marked by 0 or 1). If the input has 3 tracks, the then output table should have a 6 column table
Finally, I want to store each output table in a cell array marked by the varname of the input column (y98, y99, y20, etc), as I need to process over 200 columns in my original data.
I have attached a sample input (tempData) and output for the first coumn that i want (tempDataOut).
Thanks in advance.I have a table containing string data that represents cyclone certain and uncertain tracks. Each cell in the table may contain multiple track numbers (seperated by a space), where the presence of ‘x’ beside a number indicates uncertainty in that track. For example, in tempData(7,1) = "30 25x", ’30’ is a certain track, and ’25’ is uncertain.
I need to write a code that parses each cell in a column of tempData, separates the track numbers and their uncertainty markers (‘x’), and outputs a (in this case) 4-column table for each column in tempData. The headers of the output table should be track1, uncert1, track2, uncert2, corresponding to the parsed tracks and their certainty indicators (marked by 0 or 1). If the input has 3 tracks, the then output table should have a 6 column table
Finally, I want to store each output table in a cell array marked by the varname of the input column (y98, y99, y20, etc), as I need to process over 200 columns in my original data.
I have attached a sample input (tempData) and output for the first coumn that i want (tempDataOut).
Thanks in advance. I have a table containing string data that represents cyclone certain and uncertain tracks. Each cell in the table may contain multiple track numbers (seperated by a space), where the presence of ‘x’ beside a number indicates uncertainty in that track. For example, in tempData(7,1) = "30 25x", ’30’ is a certain track, and ’25’ is uncertain.
I need to write a code that parses each cell in a column of tempData, separates the track numbers and their uncertainty markers (‘x’), and outputs a (in this case) 4-column table for each column in tempData. The headers of the output table should be track1, uncert1, track2, uncert2, corresponding to the parsed tracks and their certainty indicators (marked by 0 or 1). If the input has 3 tracks, the then output table should have a 6 column table
Finally, I want to store each output table in a cell array marked by the varname of the input column (y98, y99, y20, etc), as I need to process over 200 columns in my original data.
I have attached a sample input (tempData) and output for the first coumn that i want (tempDataOut).
Thanks in advance. data process MATLAB Answers — New Questions