I found the solution to my problem. It was simply an error in the name of a folder in the path. It contained " - " which apparently is not allowed. Compiling in another folder (Documents\MATLAB) worked fine. I was even able to copy the compiled files back into the original folder and use them in my simulations.
you cannot keep Simscape library blocks from reverting to basic block when you regenerate the blocks with ssc_build.
To avoid this, you could create a custom library "myprettylib" where you drag the blocks from your library "mylib" generated by ssc_build. You can customize the appaerance of these blocks, and their content is linked to the original Simscape library "mylib". When you modify the simscape code and regenerate, then "mylib" will be refreshed, but not "myprettylib", so you'll keep the appearence of the block.
Best Answer