0

I have a file created in MakeHuman with the extension .mhm. In windows, I can open the file with WordPad and I can see the following contents:

# Written by MakeHuman 1.1.1
version v1.1.1
tags 001_Final
camera 8.0 1.0 0.021307010478 0.846332182106 0.541236909817 1.1625
modifier nose/nose-flaring-decr|incr -0.080000
modifier mouth/mouth-dimples-in|out 0.460000
modifier breast/breast-trans-down|up 1.000000
modifier nose/nose-trans-backward|forward 0.206000
modifier macrodetails-universal/Muscle 0.500000
modifier mouth/mouth-scale-horiz-decr|incr -0.080000
modifier macrodetails/African 0.460000
modifier neck/neck-trans-down|up -0.174000
modifier macrodetails-proportions/BodyProportions 0.786000
modifier mouth/mouth-laugh-lines-in|out 0.080000
modifier torso/torso-scale-horiz-decr|incr -0.048000
modifier neck/neck-scale-depth-decr|incr 0.158000
modifier torso/torso-trans-backward|forward 0.032000
modifier neck/neck-scale-horiz-decr|incr -0.620000
modifier nose/nose-trans-down|up 0.096000
modifier head/head-scale-depth-decr|incr -0.222000
modifier eyes/r-eye-bag-decr|incr -0.222000
modifier mouth/mouth-lowerlip-ext-down|up -0.206000
modifier macrodetails/Gender 0.000000
modifier torso/torso-scale-vert-decr|incr -0.064000
modifier head/head-angle-in|out -0.126000
modifier nose/nose-point-width-decr|incr 0.190000
modifier macrodetails-height/Height 0.690000
modifier breast/BreastSize 0.738000
modifier mouth/mouth-scale-vert-decr|incr -0.350000
modifier mouth/mouth-lowerlip-middle-down|up -0.666000
modifier head/head-invertedtriangular 0.937000
modifier nose/nose-hump-decr|incr -0.112000
modifier nose/nose-septumangle-decr|incr 0.048000
modifier nose/nose-base-down|up -0.064000
modifier torso/torso-trans-down|up 0.080000
modifier nose/nose-nostrils-width-decr|incr -0.968000
modifier mouth/mouth-trans-down|up -0.016000
modifier macrodetails/Age 0.500000
modifier mouth/mouth-angles-down|up 0.476000
modifier neck/neck-double-decr|incr -0.080000
modifier breast/BreastFirmness 1.000000
modifier macrodetails/Asian 0.000000
modifier eyebrows/eyebrows-angle-down|up -0.032000
modifier breast/breast-point-decr|incr -0.842000
modifier nose/nose-scale-depth-decr|incr 0.286000
modifier head/head-oval 0.040000
modifier forehead/forehead-temple-decr|incr 0.302000
modifier mouth/mouth-trans-in|out -0.080000
modifier head/head-fat-decr|incr 0.112000
modifier head/head-age-decr|incr -0.254000
modifier macrodetails/Caucasian 0.540000
modifier nose/nose-trans-in|out 0.016000
modifier nose/nose-curve-concave|convex -0.016000
modifier head/head-trans-in|out 0.016000
modifier head/head-square 0.357000
modifier eyes/r-eye-bag-in|out -0.238000
modifier mouth/mouth-upperlip-volume-decr|incr -1.000000
modifier head/head-scale-horiz-decr|incr 0.080000
modifier chin/chin-prognathism-decr|incr -0.032000
modifier nose/nose-scale-vert-decr|incr -0.048000
modifier head/head-round 0.151000
modifier nose/nose-nostrils-angle-down|up -0.206000
modifier nose/nose-compression-compress|uncompress -0.142000
modifier head/head-rectangular 0.286000
modifier mouth/mouth-cupidsbow-decr|incr -0.048000
modifier head/head-back-scale-depth-decr|incr -0.334000
modifier breast/breast-dist-decr|incr -0.270000
modifier eyebrows/eyebrows-trans-backward|forward -0.286000
modifier nose/nose-point-down|up 0.270000
modifier nose/nose-scale-horiz-decr|incr -0.476000
modifier mouth/mouth-upperlip-width-decr|incr 0.714000
modifier torso/torso-trans-in|out 0.080000
modifier neck/neck-scale-vert-decr|incr 0.334000
modifier chin/chin-bones-decr|incr -1.000000
modifier macrodetails-universal/Weight 0.500000
modifier mouth/mouth-trans-backward|forward -0.588000
modifier neck/neck-trans-in|out -0.080000
modifier nose/nose-greek-decr|incr -0.206000
modifier mouth/mouth-scale-depth-decr|incr 0.096000
modifier mouth/mouth-cupidsbow-width-decr|incr -0.080000
modifier mouth/mouth-lowerlip-volume-decr|incr -1.000000
hair Braid01 eead6f99-d6c6-4f6b-b6c2-210459d7a62e
eyebrows eyebrow008 79ea307f-a942-40dd-bf50-bbaa41f02034
eyes HighPolyEyes 2c12f43b-1303-432c-b7ce-d78346baf2e6
pose tpose.bvh
clothes female_casualsuit02 9896f4a4-a718-4bdd-8482-52e1855160f6
clothesHideFaces True
skinMaterial skins/default.mhmat
material Braid01 eead6f99-d6c6-4f6b-b6c2-210459d7a62e braid01.mhmat
material HighPolyEyes 2c12f43b-1303-432c-b7ce-d78346baf2e6 eyes/materials/brownlight.mhmat
subdivide False

I need to import this file in matlab, make a few changes and then export it again as .mhm. Before doing anything, I wanted to be sure that I can indeed save the file with this format but I'm having problems doing so. First, I have loaded it as a Table just using the GUI for now.

Then I tried saving with

save('Final.mhm', 'Final')

The file gets saved but when I try to open it, it only opens a series of seemingly gibberish characters. Then I tried:

writetable(Final, 'ProvaFinal.txt')

This works. I can save as .txt and then manually change the extension to .mhm

However, I would like to do everything programmatically in Matlab (also I have to do this for hundreds of files).

I tried:

writetable(Final, 'ProvaFinal.mhm')

As expected, it didn't work. Can I save a Matlab file as a .mhm?

Here is a copy of the file https://drive.google.com/file/d/1RcS_S3dJVBdrXEc6ibB9KTcm1eU4W-xt/view?usp=sharing

Pranav Hosangadi
  • 23,755
  • 7
  • 44
  • 70
Glu
  • 327
  • 3
  • 14
  • I see that the picture didn't get loaded, but you can just download the file from drive using the link at the end of my post – Glu Oct 22 '20 at 17:34

1 Answers1

0

File extensions aren't really important. In this case, however, the .txt extension implicitly tells Matlab that you want to write a space-delimited file.

From the documentation:

writetable(T,filename) writes to a file with the name and extension specified by filename.
writetable determines the file format based on the specified extension. The extension must be one of the following:

  • .txt, .dat, or .csv for delimited text files
  • .xls, .xlsm, or .xlsx for Excel® spreadsheet files
  • .xlsb for Excel spreadsheet files supported on systems with Excel for Windows®

So you should be able to write it to a .txt file and then rename the file from within MATLAB.

writetable(Final, 'ProvaFinal.txt');
movefile('ProvaFinal.txt', 'ProvaFinal.mhm');
Pranav Hosangadi
  • 23,755
  • 7
  • 44
  • 70