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 8045793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:38:39+00:00 2026-06-05T05:38:39+00:00

I have my sparse features stored in a text file in the following format

  • 0

I have my sparse features stored in a text file in the following format (ArrayIndex: Value). Currently I am parsing the text using reg-expressions and converting this to a matlab array. What I wanted to know was, is there a faster/better more MATLAB-ish approach to convert this format of data into a matlab array.

 2402:0.099061 2404:0.136546 2406:0.447161 2407:0.126333 2408:0.213803 2411:0.068189 2416:0.223526 2417:0.090420
  • 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-06-05T05:38:40+00:00Added an answer on June 5, 2026 at 5:38 am

    EDIT:

    You can read and parse the file using TEXTSCAN, then the build sparse matrix from those values:

    fid = fopen('input.txt');
    C = textscan(fid, '%f:%f');
    fclose(fid);
    C = sparse(1,C{1},C{2});
    

    result:

    >> C
    C =
       (1,2402)     0.099061
       (1,2404)      0.13655
       (1,2406)      0.44716
       (1,2407)      0.12633
       (1,2408)       0.2138
       (1,2411)     0.068189
       (1,2416)      0.22353
       (1,2417)      0.09042
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was wondering if there's any way to have a scipy.sparse.csc_matrix format for mlpy
I have the following sparse matrix that contains O(N) elements boost::numeric::ublas::compressed_matrix<int> adjacency (N, N);
I have tried following code for creating sparse graph in MATLAB: cm = sparse([1
I have created a sparse matrix using MEX and also created a sparse matrix
I have a sparse matrix A of very high dimension around 30000x30000 . And
I have a need for a sparse matrix in up to 4 dimensions in
Imagine I have a table which stores a series of sparse vectors. A sparse
I have lots of vectors like this one below, very sparse, lots of 'NaN'.
Related to my other question , I have now modified the sparse matrix solver
Have a look at this picture alt text http://www.abbeylegal.com/downloads/2009-04-01/web%20part%20top%20line.jpg Does anyone know what css

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.