🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

run matlab script from Hypermesh makro

User: "Torben0159"
Altair Community Member
Updated by Torben0159

Hello,

is it possible to run a matlab script from a Hypermesh makro? What i want to do is

- setup modal analysis in Hypermesh

- run tcl makro, which executes the solver

- saving the pch file from the modal analysis

- run the matlab script (which imports the pch file and exports a txt file)

- import the txt file within the tcl script

- do some further actions....

Points 2-5 should all be done in the same makro. If it is not possible, how could you do that in another way (I dont know much about programming stuff yet)?

Find more posts tagged with

Sort by:
1 - 1 of 11
    User: "tinh"
    Altair Community Member
    Accepted Answer
    Updated by tinh

    Hi,

    to run matlab script from hypermesh, you should write the script to a *.m file, and call matlab.exe with that *.m file

     

    set matlab "C:/path/to/matlab.exe"

    set matfile "C:/path/to/script.m"

    set matscript {

           ... do matlab calculations

    }

    set fpt [open $matfile w]

    fconfigure $fpt -encoding utf-8

    puts $fpt $matscript

    close $fpt

     

    exec $matlab -r [string map {/ \\\\} $matScript]