Opening .mat files in Atom


#1

Hello!
I’ve just started using Atom for working with Matlab files. I was trying to open .mat file but it seems like Atom can’t read the file. Does anyone know how to read .mat files in Atom?

Will be extremely grateful for your help!
Alex


#2

Atom is a code editor, and as such is only able to open plain-text files by default (since that’s what most programming languages are written in). It can be expanded to be able to open anything, but it requires a JavaScript library that knows how to open the file in question.

Why did you choose Atom for this purpose?


#3

MAT files are data files. What do you want to see as formatted text in the data file?
Can you give a little sample please.

```
place your extract like this
```

#4

Hi - thanks for your reply! Im using some non-standard matlab files (Dynare/.mod) and using Atom makes it much easier to read, edit and organise the code than Matlab. I can execute them on Atom however these files produce data output in .mat form which I want to examine without having to switch back to matlab ‘workspace’.

is there a particular javascript library which would be helpful for this particular purpose that you can suggest?


#5

Hi DanPadric! the .mat file is viewed in matlab like a spreadsheet/table format. however in the work im doing the variables are in sub-structures of other variable names. Ideally it would be great to replicate the workspace view in matlab on atom. is this possible?


#6

You’re asking in the wrong place. MATLAB is a very specific domain of knowledge used in very specific industries. I don’t have any knowledge of where one would go to discover this information, and since you use MATLAB, you would be better armed to Google for open-source .mat readers.

The interpreter itself doesn’t have to be in JavaScript. Some are in Ruby, some are in Python, and some are executable binaries. All it has to do is take the .mat file and split out JSON so that Atom can consume it and work with the information in the file.


#7

Thank you for yoru help and advices!
I appreciate it!


#8

Hi Alex,

It must be close to 22 years since I last worked with Matlab related stuff. I have no clue on how the MAT file even looks like. I did try to source a sample but my google-karma is disrupted by bad vibes.

In your shoes I would probably look into what Octave could help me with. There should be some hope according to: https://stackoverflow.com/questions/9915658/how-do-you-open-mat-files-in-octave .

Back to the theme at hand. I assume a MAT file is a text file that can be opened in Atom, but you would want to have some formatting to it. If you want to have a formatting as you describe, then there is some work ahead to get it done. Getting the syntax highlighting is not so much the issue. It is the spreadsheet type behaviour.

Even packages that I have looked into is not great for displaying text in a spreadsheet manner. Creating spacing between “columns” is not as much an issue as the selection and navigation. Some community packages exist and I am sure the guys would be happy to share ideas there. I am think it would frustrate you more.

It is in the realm of possibility to get some tools or design something, but it is going to take more effort than it is worth. Other alternative to solving your problem might be in: https://www.google.com/search?q=vscode+matlab.

In your shoes I would probably use LibreOffice Calc in some way. Perhaps I should mention I am not a coder like others here.

Sorry for not being of more of help to you. I welcome your thoughts on the matter.