You might think that integrating MuPad into Matlab is much better.
Direct transfer from variables and strings from Matlab to MuPad, in addition to symbolic expressions ( setVar ), seems impossible. Correct me if I am wrong. However, you can write files in Matlab with a relative path and read files in MuPad with a relative path.
Thus, you can write the path where the MuPad procedures are stored to a text file located in the same folder as the MuPad notebook:
%// determined with pwd, cd and string manipulation etc MuPadNotebookPath = 'C:\projectFolder\ABC\abc\' MuPadProceduresPath = 'C:\DEF\GHI\'; fid = fopen( [MuPadNotebookPath '\parameters.txt'], 'w'); fprintf(fid,'%s\r\n%', strrep(MuPadProceduresPath ,'\','\\')); %' fclose(fid);
Now in 'C:\projectFolder\ABC\abc\' will be a parameters.txt file.
In MuPad, you can use the NOTEBOOKPATH environment variable to get both the parameters.txt directory and myMupadNotebook.mn directory .
ftextinput can then be used to read into the path 'C:\DEF\GHI\' from a text file. Finally, you can install READPATH .
cfgfile := NOTEBOOKPATH . "parameters.txt": rpath = ftextinput(cfgfile, rpath): READPATH := rpath: read("MyMupadProcedure.mu");
In general, it looks like this:
nb = mupad(MuPadNotebookPath); fid = fopen( [MuPadNotebookPath '\parameters.txt'], 'w'); fprintf(fid,'%s\r\n%', strrep(MuPadProceduresPath ,'\','\\')); %' fclose(fid); status = evaluateMuPADNotebook(nb);