Open .fig files for editing without having MatLab

69 views (last 30 days)
Tyler on 7 Dec 2022
Commented: Rik on 9 Dec 2022
I have a code that creates plots and save each plot as both a .fig file and a .jpg file. I then created a standalone desktop app that others can use to do some batch processing of data into graphs.
Is there a way they can open the .fig files with only having Runtime installed and not a full version of MatLab in case they need to make some changes to the plot (i.e. lines colors, sizes, etc.)?

Answers (2)

Walter Roberson
Walter Roberson on 7 Dec 2022
The interactive edit tools such as Property Inspector are not available in compiled executables.
You could write your own code that permitted them to manipulate the properties -- doing findobj() and injecting selection callbacks and similar. It might be a bit tedious.
Walter Roberson
Walter Roberson on 8 Dec 2022
I was explaining why the usual tools are not available in compiled executables: because they would enable changes to the code.
I think Mathworks could have provided a tool that made those parts read-only, but they choose not to. I think they consider those tools more "development" and "debugging" rather than user interface.
Tyler on 8 Dec 2022
Oh I got you!
Yeah it would be nice to have a little functionality for users of built code. Just some simple things like the ability to change colors or toggle lines off and on of a saved .fig plot. Little things like that would make MatLab more appealing to smaller companies and make them not seem quite as money hungry.

Sign in to comment.

Rik on 8 Dec 2022
You could try using GNU Octave to modify the fig file.
There are many downsides to using Octave instead of Matlab (I'm still planning to make a thread with a list some day), but for most cases it is free to use.
Not all code will work, and the apearance is a bit different, but usually simple things are plug and play. If a piece of code works in R2007b and in R2022b, you have almost 100% chance it will work in Octave.
Tyler on 8 Dec 2022
I actually just downloaded Octave GNU yesterday and did a little manipulating to get the code to some what run. I still have to figure out the text file combining since readtable() doesn't work in Octave. I am unsure how well the plot editing is though. The simple plots that I made to test some of the code didnt really have much options within the figure window to change anything. When I have more time I am going to play around with Octave some more.
If you know how to have Octave read a txt file, eliminate the top 6 rows and then combine three such files into one and save it that would be much appreciated (MatLab code that does it is below)
% Combine HORIZONTAL text files
%location = input("location of test point: ","s");
fileName = "HORZ NOM.txt";
dL = dir(fullfile(directory,'*HLF*NOM.txt'));
dM = dir(fullfile(directory,'*HMF*NOM.txt'));
dH = dir(fullfile(directory,'*HHF*NOM.txt'));
for i = 1:numel(inf)
tD = readtable(fullfile(dL(i).folder,dL(i).name),'numheaderlines',6,'readvariablenames',1);
tD = [tD;readtable(fullfile(dM(i).folder,dM(i).name),'numheaderlines',6,'readvariablenames',1)];
tD = [tD;readtable(fullfile(dH(i).folder,dH(i).name),'numheaderlines',6,'readvariablenames',1)];
% do whatever with each set here before going on...
writetable(tD,fullfile(directory, fileName));
Rik on 9 Dec 2022
You can get my readfile function from the file exchange (I make sure all my submissions are compatible with Octave). It will automatically handle UTF-8 rich text if present and give you a cellstr (similar to how readlines will give you a string vector). I suspect you want to keep the header line and remove the following 6 lines, which is easy to do with indexing.
You're reading your data as a table. That specific data type doesn't exist in Octave (yet?), so you will have to use an alternative method to read your csv file. Luckily the dlmread function is implemented (and the csvread function, should you prefer it. You will have to change your code to use normal arrays instead.
You should also note that the Name=Value syntax is not supported in Octave (yet). This is a very recent addition in Matlab, so that isn't unexpected. You should also note that in Octave there isn't a difference between using double or single quotes, as they both produce char vectors. In Matlab a double quote will produce a string scalar.

Sign in to comment.


Find more on Measurements and Spatial Audio in Help Center and File Exchange




Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!