MATLAB Answers

Patrick
0

Suppress Code and/or view Headings and Text in Live Editor

Asked by Patrick
on 9 Jun 2018
I'm having my first go trying to write a report using MATLAB Live Editor rather than using R since I found out about a package called gramm which in my opinion does a more aesthetically pleasing job plotting than default matlab.
In R you can an .RMD file which would allow me to do what I'd like to have. In short I either want 1) The headings and text to show up in the "live view" on the right or less preferably 2) Be able to fold the code as you would in a normal script so I don't have to look at 100s of lines of code when its not in use.
I've photoshopped some quick figures to better showcase my question. The first figure is the current look
This image is what I'd like to have (image is photoshopped)
%%create some fake input table
inputTable = array2table(rand(50,8));
% get the input size
sz = size(inputTable);
n_row = sz(1);
n_var = sz(2);
% convert inputTable into a column array
inputData = table2array(inputTable);
inputColumn = inputData(:)';
% convert variable names to a column array (do you have a Matlab version with repelem? it's great!)
variableNames = inputTable.Properties.VariableNames;
variableColumn = repelem(variableNames,n_row)';
% create x data column array
xColumn = repmat(1:n_row,1,n_var)';
% create a gramm object that is facet wrapped on the variable
f = figure('Position',[100 100 800 400]);
g = gramm('x',xColumn,'y',inputColumn,'color',variableColumn); % add the color aesthetic
g.facet_wrap(variableColumn);
g.geom_point();
g.geom_line(); % and another geometry
g.draw();

  0 Comments

Sign in to comment.

0 Answers