matlab - Transform current workspace variables into code -


sometimes rather not show data other people , therefore need modify it. when ready export, wish export workspace data, instance table, is, posting here instance.

i know generate script function, , feel answer related not that, , publish not command require. how do that?

update example:

how print table code?

%% table example export workspace  t={'a2p3';'a2p3';'a2p3';'a2p3 (extra1)';'a2p3 (extra1) , (extra 2)';'a2p3 (extra1)';'b2p3';'b2p3';'b2p3';'b2p3 (extra 1)';'a2p3'}; a={1 1 0 1 1 0 1 1 0 1 1 }  t(:,2)=num2cell(1); t(3,2)=num2cell(0); t(6,2)=num2cell(0); t(9,2)=num2cell(0);  t=table(t(:,1),t(:,2));  class(t.var1); class(t.var2);  t.var1=categorical(t.var1) t.var2=cell2mat(t.var2)  class(t.var1); class(t.var2); 

since matlab 2014a there new feauture:

matlab provides ability save workspace variables matlab script. once script saved, can regenerate workspace variables running script. click save workspace on matlab desktop , select matlab script (*.m) in save type menu. alternately, use matlab.io.savevariablestoscript perform operation command line.

documentation fo matlab.io.savevariablestoscript

if don't have new version, need write own i/o routine variables. it's quite easy generic numerical arrays, depends on case.


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -