# Save transform as .mat

**URL:** <https://discourse.slicer.org/t/save-transform-as-mat/28792>\
**Category:** Support\
**Tags:** transforms\
**Created:** [April 7, 2023, 9:16am UTC](https://discourse.slicer.org/t/save-transform-as-mat/28792 "2023-04-07T09:16:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Melanie](https://avatars.discourse-cdn.com/v4/letter/m/35a633/32.png) [@Melanie](https://discourse.slicer.org/u/Melanie)\
**Post date:** [April 7, 2023, 9:16am UTC](https://discourse.slicer.org/t/save-transform-as-mat/28792/1 "2023-04-07T09:16:14Z")

</div>

Hi

Could some please help me to save a LinearTransform as .mat file using commandline pls.

I have checked script repository , and tried chat GPT ,  
Could find anything.

I generate 50-100 linear transforms (after model registration) with displacement data, that needs saving as .mat files , so I am hoping to do it CLI and loop

Thanks

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [April 9, 2023, 1:52am UTC](https://discourse.slicer.org/t/save-transform-as-mat/28792/2 "2023-04-09T01:52:39Z")

</div>

I would recommend to save as .txt file. It is human-readable and easy to read and write in both Slicer and Matlab.

Matlab reader and writer are available here:

> <https://github.com/PerkLab/SlicerMatlabBridge/blob/master/MatlabCommander/commandserver/cli_lineartransformread.m>

> <https://github.com/PerkLab/SlicerMatlabBridge/blob/master/MatlabCommander/commandserver/cli_lineartransformwrite.m>
