Creating and visualizing a table


(Cedric) #1

This is a table format related issue.
For that reason, I include all the code related to the formatting but not to the COP which gives us no trouble.

import mlreportgen.dom.*;
doc=Document('/fully/qualified/path/to/restab');
table0 = ModelAdvisor.Table(4,4);

% column headings
table0.setColHeading(1, ['var1 [%]']);
table0.setColHeading(2, ['var2 [ms]']);
table0.setColHeading(3, ['var3 [%]']);
table0.setColHeading(4, ['var4 [ms]']);

% row headings
for n=1:4
    table0.setRowHeading(n,['Fs=',num2str(FsArr(n))]);
end

for n=1:length(FsArr)
    Fs=  [...] ;
    % GP optimizations here
    cvx_begin gp quiet
        [...];
    cvx_end
    cvx_status
    var1(n)=[..]; var2(n)=[..]; var3(n)=[..]; var4(n)=[..];
    
    % Set table content
    rowIndex=n;
    table0.setEntry(rowIndex,1,num2str(var1(n)));
    table0.setEntry(rowIndex,2,num2str(var2(n)));
    table0.setEntry(rowIndex,3,num2str(var3(n)));
    table0.setEntry(rowIndex,4,num2str(var4(n)));
end;

append(doc,table0);
close(doc);
rptview(doc.OutputPath);

The result of the above is a correct optimized set of results, but when we try to visualize the table , we only get a window whose only tab is entitled “root.html”, and with mention (in the window of: “[1x1 ModelAdvisor.Table]”.

The question is we are probabby missing something about format and all, would any one care to give us pointers on how to visualize formatted table of type ‘table0’ ? Thanks.


(Mark L. Stone) #2

Other than that you run CVX in the middle there, what does your difficulty have to do with CVX?

Is this a non-CVX MATLAB matter? If so, perhaps you should inquire at https://www.mathworks.com/matlabcentral/answers/index .


(Cedric) #3

I just did that. Thank you for the heads-up.