Reading matrices from MATLAB (.mat) in C#

Since last year, it is now possible to read MATLAB files from .NET applications using the Accord.NET Framework. Let’s say you have a .mat file stored in your desktop. You can load it in C# using:

To install the Accord.NET Framework into your C# application, install Accord.Math and Accord.IO through NuGet.

4 Comments

  1. Cesar –
    Accord.net is amazing – I’m only beginning to scratch the surface of it’s functionality. Thank you.

    I very much enjoy using your samples, but am concerned/confused with applying them into a production environment.

    Documentation or a tutorial would be quite helpful on migrating from “training” to production (where memory is at a premium, so hopefully only the weights/bias/etc is used, not the entire dataset in a training model scenario). Most ML models require “training data.” When the sample program is stopped, the training is gone. I saw you had a post regarding Accord.IO to serialize objects. When this occurs, does the entire learned data stay in memory, or are only the critical variables (weights, etc) instantiated?

    In a production environment, it would be nice if there were “lightweight” versions of the models (perhaps memory and processor optimized) that drove decisions after being trained in a development environment – lightweight models that could continue to learn, where reinforced data could be saved in the event a server needs to be upgraded/rebooted, etc. Are there any “production roadmaps” that you or others have written?

    Thank you again for your efforts in creating an amazing library.

    Sean

  2. Thanks for amazing work.

    Actually I have a Issue with this framework, I try to run in other software(No Visual Studio), but fire a issue when this program start.

    The issue shows this:

    26/12/2017 8:10:22 p. m. Default Unable to retrieve type infos from assembly ‘Accord.Math’: System.Reflection.ReflectionTypeLoadException: No se pueden cargar uno o varios tipos requeridos. Recupere la propiedad LoaderExceptions para obtener más información.
    en System.Reflection.Module._GetTypesInternal(StackCrawlMark& stackMark)
    en System.Reflection.Assembly.GetTypes()
    en NinjaTrader.Cbi.AssemblyDictionary.GetTypes(Type superClass)

    I have no idea why, every assembly load correctly except ‘Accord.Math’. the DLL´s imported are Accord.dll
    Accord.IO.dll
    Accord.Math.Core.dll
    Accord.Math.dll
    (lib/net35)

    Thanks for any help!

Leave a Reply

Your email address will not be published. Required fields are marked *