0

This is what my variable, call it A, looks like in MATLAB (only 10 cells):

A in MATLABe

Then, this is what the first cell 1,1 looks like (goes on for 20 cells):

A{1,1}

Then, this is what the first cell of that image looks like (goes on for 32 cells):

A{1,1}{1}

And, I want to make a .npy file that when loaded and saved as variable data & then printed, looks like this:

required result in python

How can I transfer the .mat file to a .npy so that when I load it, it looks like above?

2
  • 1
    Have you tried scipy.io.loadmat? Or are you trying to creat the equivalent in numpy from scratch?
    – hpaulj
    Commented Feb 7, 2021 at 15:27
  • x=np.zeros((10,20,30)) should have the desired shape. You could then set a subset of the elements with x[:,n:,n:] = 1.
    – hpaulj
    Commented Feb 7, 2021 at 15:59

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.