Grouping data set in each row and showing every value seperated by a "," and outputing it in a table

1 次查看(过去 30 天)
Hello,
As seen in the picture, I would like every number in the row that is not 'nan' to be grouped together and seperated by a "," and put into the 18x2 table, in its repspective row. For example, in the 18x11 figure, row 1 should be grouped as "20393,20394,20395,20396,20397,20398,20399,20400" and this result would be displayed in row 1 of the 18x2 table. As a Bonus, if you could create a thrid column in the current 18x2 table to keep a count of the total number of values reported.
Here is my current code, but as seen by the outcome in the picture, it only reports the rows that are filled with values, and compely ignores any row with 'na', as well as only reporting the first and last number in the 18x2 table
%10 sec
TenSecResultSummary = string(TenSecResult(:,1)) + '-' + string(TenSecResult(:,end));
%number of violations in each pulse
boo2=~ismember(TenSecResult,[ShortPowerViolationX]);
TenSecResult(boo2)= nan
TenSecViolationReport = string(TenSecResult(:,1))+ ',' + string(TenSecResult(:,end));
TenSecReport=table(TenSecResultSummary,TenSecViolationReport)

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Tables 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by