Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7447273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:33:26+00:00 2026-05-29T12:33:26+00:00

Here is an minimal example of the error I get. If I understood the

  • 0

Here is an minimal example of the error I get. If I understood the documentation correctly, this should be working, but it seems I did not.

a={}
a['test1']=1
a['test2']=2
a['test3']=3
import scipy.io as io
io.savemat('temp',{'a':a})
b = io.loadmat('temp')
b['a'].keys()

Traceback (most recent call last):
  File "<input>", line 1, in <module>
AttributeError: 'numpy.ndarray' object has no attribute 'keys'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T12:33:28+00:00Added an answer on May 29, 2026 at 12:33 pm

    You seem to be operating under the assumption that scipy.io.savemat is intended to be able to save a standard dictionary. I don’t believe that is the case. The dictionary argument holds the names of numpy arrays which are written out into the Matlab file. So you can do something like this

    import scipy.io as io
    import numpy as np
    
    y1=np.array([1,2,3,4])
    y2=np.array([10,20,30,40])
    y3=np.array([100,200,300,400])
    
    a={}
    a['test1']=y1
    a['test2']=y2
    a['test3']=y3
    io.savemat('temp',a)
    b = io.loadmat('temp')
    
    print b['test1']
    print b['test2']
    print b['test3']
    

    which gives:

    [[1]
     [2]
     [3]
     [4]]
    [[10]
     [20]
     [30]
     [40]]
    [[100]
     [200]
     [300]
     [400]]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First here's what I'm using and trying to do: the minimal setup for this
I came across some code which kind of puzzled me. Here's a minimal example
First attempt It's difficult to make this question pithy, but to provide a minimal
I am using mingw g++ 4.6.1 with -O0, WinXP SP2. Minimal working example is
Here is my minimal example: program test implicit none real :: testfunc write(*,*) Writing
Here's a minimal batch file, demo.bat , to illustrate my problem: @ECHO off set
Here's an interesting problem to solve in minimal amounts of code. I expect the
Sample: I've created a minimal set of files that highlight the issue here: http://uploads.omega.org.uk/Foo3.zip
The minimal example of the problem I'm having is reproduced below: #include <set> using
I have actually two questions but they are kind of related so here they

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.