Create an extra row in a table that show the means of all columns (but without any extra headings)
Hello, I have a table that I have created and display it in text area
This is my code:
params = ["ROI_L";"ROI_C";"ROI_R"];
tbl = table(params,FWHMX,FWHMY,FWHM2D,CenInt);
str = formattedDisplayText(tbl);
str = regexprep(str,'</?strong>’,”);
ReportMessage(app,str); % My own function, see below
At the bottom I have attempted to add the means of each column by doing this:
% Get Means
M = varfun(@mean, tbl, ‘InputVariables’, @isnumeric);
M1=table2cell(M)
M1=[{‘Mens:’},M1]
str = formattedDisplayText(M1)
str = regexprep(str,'</?strong>’,”);
ReportMessage(app,str); % My own fucntion, see below
But its wrapping and not aligned to the table. The same thing happens if I DONT convert the table to a cell array via (as well as adding exctra headings
M1=table2cell(M)
M1=[{‘Mens:’},M1]
This is how it looks without the table2cell step:
Is there a way in table format to get the means of the columns (but without any column header)
heres my report message function
function ReportMessage(app,msg)
currString=get(app.MessagesTextArea,’Value’);
%currString=[{char(msg)};currString]; %add to top of message box
currString=[currString; {char(msg)}]; %add to bottom of message box
app.MessagesTextArea.Value=currString;
drawnow;
scroll(app.MessagesTextArea,’bottom’);
endHello, I have a table that I have created and display it in text area
This is my code:
params = ["ROI_L";"ROI_C";"ROI_R"];
tbl = table(params,FWHMX,FWHMY,FWHM2D,CenInt);
str = formattedDisplayText(tbl);
str = regexprep(str,'</?strong>’,”);
ReportMessage(app,str); % My own function, see below
At the bottom I have attempted to add the means of each column by doing this:
% Get Means
M = varfun(@mean, tbl, ‘InputVariables’, @isnumeric);
M1=table2cell(M)
M1=[{‘Mens:’},M1]
str = formattedDisplayText(M1)
str = regexprep(str,'</?strong>’,”);
ReportMessage(app,str); % My own fucntion, see below
But its wrapping and not aligned to the table. The same thing happens if I DONT convert the table to a cell array via (as well as adding exctra headings
M1=table2cell(M)
M1=[{‘Mens:’},M1]
This is how it looks without the table2cell step:
Is there a way in table format to get the means of the columns (but without any column header)
heres my report message function
function ReportMessage(app,msg)
currString=get(app.MessagesTextArea,’Value’);
%currString=[{char(msg)};currString]; %add to top of message box
currString=[currString; {char(msg)}]; %add to bottom of message box
app.MessagesTextArea.Value=currString;
drawnow;
scroll(app.MessagesTextArea,’bottom’);
end Hello, I have a table that I have created and display it in text area
This is my code:
params = ["ROI_L";"ROI_C";"ROI_R"];
tbl = table(params,FWHMX,FWHMY,FWHM2D,CenInt);
str = formattedDisplayText(tbl);
str = regexprep(str,'</?strong>’,”);
ReportMessage(app,str); % My own function, see below
At the bottom I have attempted to add the means of each column by doing this:
% Get Means
M = varfun(@mean, tbl, ‘InputVariables’, @isnumeric);
M1=table2cell(M)
M1=[{‘Mens:’},M1]
str = formattedDisplayText(M1)
str = regexprep(str,'</?strong>’,”);
ReportMessage(app,str); % My own fucntion, see below
But its wrapping and not aligned to the table. The same thing happens if I DONT convert the table to a cell array via (as well as adding exctra headings
M1=table2cell(M)
M1=[{‘Mens:’},M1]
This is how it looks without the table2cell step:
Is there a way in table format to get the means of the columns (but without any column header)
heres my report message function
function ReportMessage(app,msg)
currString=get(app.MessagesTextArea,’Value’);
%currString=[{char(msg)};currString]; %add to top of message box
currString=[currString; {char(msg)}]; %add to bottom of message box
app.MessagesTextArea.Value=currString;
drawnow;
scroll(app.MessagesTextArea,’bottom’);
end table, varfun, formatteddisplaytext MATLAB Answers — New Questions