3

I am a beginner with Python and I am encountering the following problem.

I deal with sensors data. Each sensor gives me a np.array with varying size (n,p). For the moment, I just add the new array into a list, and then convert this list in a array, which gives an array of arrays. I would like to export the final result (equivalent to a multi-dimensionnal array with variable size) in a written file that I want to be readable in Matlab to test advanced algorithms on it. My question is the following : is there a better way to collect the data to export it in Matlab? And what could be a possible way to write a Matlab readable file from this multi-dimensional array?

1 Answer 1

1

Yes there is a better way : use scipy !!
Then you can use savemat method to "Save a dictionary of names and arrays into a MATLAB-style .mat file"
the code would be something like this:

import numpy, scipy.io
your_array = a multi dimential matrix
scipy.io.savemat('your direction and name', mdict={'arr': your_array})
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.