This project is an humble repository of function dedicated to copy past variables from matlab/octave console to cpp files.
Format a 1d or 2d vector as a std::array<float, n> or a std::array<std::array<float, n>, m> producing an output as follow :
>> t
t =
11.6997743076000 13.7337354371000 17.8483328482000
11.5903137386000 15.9315725537000 18.5474302023000
14.0794740788000 16.6252348786000 15.0312203266000
16.8540274713000 17.1126160432000 17.9989386368000
19.6875419688000 18.0549750917000 14.8710316389000
11.2724477114000 18.8196041977000 10.6267505374000
16.3669281023000 14.5068392450000 12.7684727302000
15.2232480705000 14.9002723140000 11.1595056216000
18.8591214941000 11.9412386791000 19.4170347055000
11.9154093347000 17.5653143977000 14.8182949406000
17.0245093267000 17.2228349257000 15.5228081811000
13.7409305363000 10.5375238408000 16.2155068564000
18.2035667946000 18.5823974267000 15.6531984761000
17.0871861005000 15.8832768212000 11.5732039021000
13.8372911778000 16.3583831686000 18.7893236643000
12.0182781986000 11.5107919898000 11.1635132283000
10.3016081434000 19.9843666527000 11.0581281590000
10.3216815229000 18.3678793405000 13.6765461074000
19.0403437477000 19.1488876784000 10.0808640820000
10.0866981492000 12.8555150513000 10.9523011090000
>> formatAsStdArray(t,"testVarName")
std::array<std::array<float, 3>, 20> testVarName
{{
{{11.69977430760,13.73373543710,17.84833284820}},
{{11.59031373860,15.93157255370,18.54743020230}},
{{14.07947407880,16.62523487860,15.03122032660}},
{{16.85402747130,17.11261604320,17.99893863680}},
{{19.68754196880,18.05497509170,14.87103163890}},
{{11.27244771140,18.81960419770,10.62675053740}},
{{16.36692810230,14.50683924500,12.76847273020}},
{{15.22324807050,14.90027231400,11.15950562160}},
{{18.85912149410,11.94123867910,19.41703470550}},
{{11.91540933470,17.56531439770,14.81829494060}},
{{17.02450932670,17.22283492570,15.52280818110}},
{{13.74093053630,10.53752384080,16.21550685640}},
{{18.20356679460,18.58239742670,15.65319847610}},
{{17.08718610050,15.88327682120,11.57320390210}},
{{13.83729117780,16.35838316860,18.78932366430}},
{{12.01827819860,11.51079198980,11.16351322830}},
{{10.30160814340,19.98436665270,11.05812815900}},
{{10.32168152290,18.36787934050,13.67654610740}},
{{19.04034374770,19.14888767840,10.08086408200}},
{{10.08669814920,12.85551505130,10.95230110900}}
}}