I have a {15,5,2} dimensional array and each element is itself a {14,16} dimensional array. When I export/import my file as an excel file I get a {15,,5,2} dimensional array but with {} dimension for each element. Somehow it doesn't recognize each element as a matrix. Does anybody know how I can solve this problem?

Thank you.

I noticed I cannot use excel for higher dimensions, but using HDF5, I still get error.

  • $\begingroup$ What Mathematica version ? $\endgroup$ – andre314 Jun 10 '19 at 17:30
  • $\begingroup$ 11.2 but it was my bad using Excel format I guess. Do you know any other formats work properly? I examined .dat also, but changes the dimensionality $\endgroup$ – Delaram Nematollahi Jun 10 '19 at 17:47
  • 1
    $\begingroup$ Do you need to open these files in any program other than Mathematica? If you don't, then I often use ".mat" files. They import and export really quickly and are good at keeping arrays the same. The one caveat is that when you import a matrix, you have to go matrix[[1]] (or whatever your matrix name is) as the ".mat" format adds an extra {} around the overall array but doesn't mess with the components. $\endgroup$ – MassDefect Jun 10 '19 at 17:55
  • 4
    $\begingroup$ IMHO, hdf5 is the way to go. Much more efficient than .mat because it supports higher multidimensional tensors natively. $\endgroup$ – Henrik Schumacher Jun 10 '19 at 18:21
  • $\begingroup$ Thank you so much, I keep getting this error: Export::errelem: The Export element Datasets contains a malformed data structure and could not be exported to HDF5 format. $\endgroup$ – Delaram Nematollahi Jun 10 '19 at 19:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.