How do I remove brackets/braces/quotes from table entries?
Show older comments
I am using cell2table to create a table displaying the reslults computed by my script. However, the table always comes out with brackets, quotes, etc depending on the class of the variable in that cell. Below are a few rows of the output table followed by a sample of the code used to compute the variables. This is all in a big "for" loop, and coord, t_A, rul, and forecast are all preallocated as cell arrays.
Test Point, (X,Y) Classification Time Until Aged Remaining Useful Life
___________________ ______________ _______________ _____________________
{'1, (2,2)' } "Healthy" {'N/A' } {'N/A' }
{'2, (3,3)' } "Healthy" {[ 2.4354]} {[ 7.5699]}
{'3, (4,5)' } "Healthy" {[0.78741]} {[ 4.916]}
coord(i) = {[num2str(i) ', (' num2str(x) ',' num2str(y) ')']};
classname(i) = "Aged";
if i==1
t_A{1} = 'N/A';
rul{1} = 'N/A';
else
if class(i) == 1
t_A{i} = %numerical value
rul{i} = %numerical value
end
end
forecast(i,:) = {coord{i},classname(i),t_A{i},rul{i}};
results = cell2table(forecast(1:i,:),'VariableNames',{'Test Point, (X,Y)','Classification','Time Until Aged','Remaining Useful Life'});
Accepted Answer
More Answers (0)
Categories
Find more on Tables in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!