Click here to Skip to main content
15,905,967 members
Please Sign up or sign in to vote.
1.80/5 (4 votes)
See more:
1dimensional and 3dimensional data matrix matching,1d data are row matrix and 3d data are one row or columns.find corresponding matching data of 3D data according to 1d data.

for example

1.Take 1d and 3d data files.
1 d having set of elements 22,33,44,55,66
3d having 1 to 100 elements, 32 to 35 and 72 to 75..(like 32,32.1,32.2 to 35 and 72,72.1,..75)
2.hers match this 1st set of profiles ie 22,33,44,55,66 to 1 to 100 elements find the common point ie nothing but 22,33,44,55,66 only.
3.here v getting 5 points kw..ie 5 data.then this 3d data are contains 32 to 35 and 72 to 75.according to
22,33,44,55,66 data find each values of 32 to 35 and 72 to 75.(this values u take wat ever interval like that..lik 32.2,32.6…35 and 72.1 to75..each set of values contains 100 elements lke tat)..
22,33,44,55,66 find corresponding (32 to35 and 72 to 75) in between these data.
Want c programming ……………………..codes………………….please send to me..urgent….
Posted

No, people on this site are not here to help you cheat on your course work.
 
Share this answer
 
Assumed, you can implement two functions:

typedef enum {
  e3DRowData,        // X-Dump
  e3DColData,        // Y-Dump
  e3DStkData         // Z-Dump
} eDataOrientation;

// 1. Building of the 1D arrays data dump
BOOL Get1D_Dump(BYTE* pcDataDump, UINT& uiDataLen,
                int iXPos);

// 2. Building of the 3D arrays data dump
BOOL Get3D_Dump(BYTE* pcDataDump, UINT& uiDataLen,
                int iXPos, int iYPos, int iZPos, eDataOrientation);

...and the function:
// Finding of "What" in "Where", returning of the found matching index or (-1)
int TryToFind(BYTE* pbyWhere, BYTE* pbyWhat,
              UINT uiWhereLen, UINT uiWhatLen,
              size_t sizeBytesPerElement)
{
  BYTE* pbyPos   = pbyWhere;
  while (pbyPos &&
         uiWhereLen > (pbyPos - pbyWhere)) {
    // seek to the first byte matching
    pbyPos = (BYTE*) memchr(pbyPos, pbyWhat[0],
                            uiWhereLen - (pbyPos - pbyWhere));
    if (pbyPos) {
      UINT uiRest = pbyPos % sizeBytesPerElement;
      if (uiRest) {
        // it was not an edge our elements type
        pbyPos += (sizeBytesPerElement - uiRest);
        countinue; 
      }
      if (0 == memcmp(pbyPos, pbyWhat, uiWhatLen)) {
        // whole matching, done
        return int((pbyPos - pbyWhere) / sizeBytesPerElement);
      }
      // there was no whole matching, forwards...
      pbyPos += sizeBytesPerElement;
    }
  }
  return (-1);
}

...then you could write :) :

// preparing of an 1d double array
...
// preparing of an 3d double array
...

// try to find the whole 1d array at the Stack{0, 0} of the 3d array:
BYTE* pc1DData    = NULL;
UINT  ui1DDataLen = 0;
BYTE* pc3DData    = NULL;
UINT  ui3DDataLen = 0;
if (Get1D_Dump(pc1DData, ui1DDataLen,
               0 /*whole array*/) &&
    Get3D_Dump(pc3DData, ui3DDataLen,
               0 /*DataBeginningX*/,
               0 /*DataBeginningY*/,
               0 /*DataBeginningZ*/,
               e3DStkData /*a stack please*/)) {
  // The Core :)
  int iFoundPos = TryToFind(pc3DData, pc1DData,
                            ui3DDataLen, ui1DDataLen,
                            sizeof(double) /*our arrays elements type*/);
  if (-1 != iFoundPos) {
    // the 1d array is placed at the index iFoundPos
    // of the 3d arrays Stack{0, 0} :)
  }
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900