Advertisement

10.28.2007 at 11:59PM PDT, ID: 22923791
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.6

Structure of Arrays

Asked by fmufti in C++ Programming Language, Microsoft Visual C++.Net

Tags:

Hi
I am reading a file with number of frames.
frame 1
distance [3072]
intensity [3072]
amplitude [3072]
w_amplitude [3072]
frame 2...
Now I want to read the data in structure form so that I have:-
frame[0].distance[0]
frame[0].distance[1]....
...
frame[0].amplitude[0]
...
frame[1].distance[0]
and so on.
My code is below and I have placed comment where I think the structure result should come so that at the end I can pass this structure to MATLAB.


#include <iostream>
#include <stdio.h>
#include <fstream>
using namespace std;

void ReadFromFile(const char *filename, int ArraySize);
int main()
{
      static const char filename[] = "data.dat";
      int ArraySize=3072;
      ReadFromFile(filename, ArraySize);
      return 0;
      
}
void ReadFromFile(const char *filename, int ArraySize)
 {
      int i;unsigned  read_frame_no;
      unsigned short      *read_dist=new unsigned short[ArraySize], *read_ampl=new unsigned short[ArraySize],
                              *read_inten=new unsigned short[ArraySize], *read_w_ampl=new unsigned short[ArraySize];
      
      double *distance=new double[ArraySize], *intensity=new double[ArraySize];
      double *amplitude=new double[ArraySize], *w_amplitude=new double[ArraySize];
      ifstream filein(filename, ios::in | ios::binary);
      if(!filein) {  
            std::cout << "Cannot open file to read.\n"; }
            while ( filein.read((char *) &read_frame_no, sizeof(unsigned))) {
                  filein.read((char *) read_dist, sizeof( unsigned short ) * ArraySize );
                  filein.read((char *) read_inten, sizeof( unsigned short ) * ArraySize );
                  filein.read((char *) read_ampl, sizeof( unsigned short ) * ArraySize );
                  filein.read((char *) read_w_ampl, sizeof( unsigned short ) * ArraySize );
                        
                   for (i=0;i<ArraySize;i++)
                                    {
                                          distance[i]=(double)read_dist[i];
                                          amplitude[i]=(double)read_ampl[i];
                                          intensity[i]=(double)read_inten[i];
                                          w_amplitude[i]=(double)read_w_ampl[i];
                                    }
//Somewhere here I want to store it as structure format
            if (filein.eof())break;
            }
            filein.close();
            delete [] read_dist;
            delete [] read_inten;
            delete [] read_ampl;
            delete [] read_w_ampl;
            
 }
Start Free Trial
 
 
[+][-]10.29.2007 at 01:02AM PDT, ID: 20168047

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]10.29.2007 at 03:43AM PDT, ID: 20168419

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.29.2007 at 03:52AM PDT, ID: 20168446

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.29.2007 at 04:13AM PDT, ID: 20168513

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.29.2007 at 04:17AM PDT, ID: 20168530

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.29.2007 at 05:15AM PDT, ID: 20168815

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.29.2007 at 05:23AM PDT, ID: 20168858

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.29.2007 at 05:29AM PDT, ID: 20168898

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.29.2007 at 05:34AM PDT, ID: 20168923

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.29.2007 at 01:02PM PDT, ID: 20172821

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.29.2007 at 04:57PM PDT, ID: 20174077

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.30.2007 at 12:27AM PDT, ID: 20175151

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: C++ Programming Language, Microsoft Visual C++.Net
Tags: C++
Sign Up Now!
Solution Provided By: itsmeandnobodyelse
Participating Experts: 2
Solution Grade: A
 
 
[+][-]10.30.2007 at 01:01AM PDT, ID: 20175235

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.30.2007 at 06:02AM PDT, ID: 20176705

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.30.2007 at 06:07AM PDT, ID: 20176745

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.30.2007 at 06:33AM PDT, ID: 20176953

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.30.2007 at 08:17AM PDT, ID: 20177960

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.31.2007 at 05:33PM PDT, ID: 20190160

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.31.2007 at 05:59PM PDT, ID: 20190272

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.31.2007 at 06:09PM PDT, ID: 20190305

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.01.2007 at 05:56PM PDT, ID: 20197719

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.01.2007 at 11:41PM PDT, ID: 20198678

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628