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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:47:40+00:00 2026-06-14T20:47:40+00:00

I have a text file which contains a 64×64 matrix values and they are

  • 0

I have a text file which contains a 64×64 matrix values and they are complex numbers. I want to read them from a file but I’m having difficulties. Either using the complex library of C or creating a new data type for complex numbers is okay for me, I just need them read correctly.

What I mean is, whether using:

#include <complex.h>
int complex matrix[64][64];

or creating a data type for it:

typedef struct {
    int real, imag;
} Complex;

Complex matrix[64][64];

is okay for me as long as they are read correctly.

Below you can find 2×3 matrix, just to demonstrate how the numbers are in my file:

{{-32767, 12532 + 5341I, -3415 - 51331I}
 {32767I, 32609 + 3211I, 32137 + 6392I}}

So as you can see some parts have both the real and imaginary part, some just the imaginary and some just the real part, and all the imaginary numbers have upper case ‘i’ letter at the end. If you could help me with that, I would be glad.

  • 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-14T20:47:42+00:00Added an answer on June 14, 2026 at 8:47 pm

    Two common design patterns apply:
    1) Recursive descent parser that accepts a ‘language’
    2) State Machine

    Both cases can benefit from a read_char() function, that exits with error if it encounters
    anything else than ‘{‘, ‘}’, 0-9, i, +, – and which skips all white spaces (ch<=32).

    A state machine can be a bit more versatile: if at any point there is ‘+’ or ‘-‘, one can just add or subtract the next value (ending with ‘i’ or non ‘i’) to the currently accumulated value. (Then the state machine is able to also calculate 1+2-1+1i while it goes…)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a CSV file which contains numbers,date and text. I have to extract
I have text file which contains list of lonlat points. I want to send
I have a file which contains lots of numbers which I want to reduce
I have a text file which contains several hundred lines e.g. test.bin:8948549854958 They are
I have a text file which contains data. I want to set this data
I have a system that generates values in a text file which contains values
I have a text file which contains numbers like, 0.00 0.12 0.35 0.78 0.93
I have a text file which contains matrix of N * M dimensions. For
What I want to do is read a line from text file which contains
I have a text file which contains a line as a,b,a,b,a,b and I want

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.