Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.49 KB | None | 0 0
  1. int *label;
  2.  
  3. void load_dat ()
  4. {
  5. int i, j, t, k;
  6. FILE *in;
  7. char t_file[16];
  8.  
  9. printf ("nName of Raw Data File > ");
  10. scanf ("%s", t_file);
  11. in = fopen (t_file, "r");
  12. if (in == NULL){
  13. perror("fopen error");
  14. }
  15. fscanf (in, "%d %d %d", &num_pats, &a_length, &b_length);
  16.  
  17. dpt = (float **) malloc (sizeof(float *)*num_pats);
  18.  
  19. for (k=0; k<num_pats; k++){
  20. dpt[k] = (float *) malloc (sizeof(float)*(a_length+b_length));
  21. }
  22.  
  23. label = (int *) malloc (sizeof(int)*num_pats);
  24.  
  25. for (i=0; i<num_pats; i++)
  26. {
  27. for (j=0; j<a_length; j++)
  28. {
  29. fscanf (in, "%f", &dpt[i][j]);
  30. }
  31.  
  32. fscanf (in, "%d", &label[i]);
  33.  
  34.  
  35. if (label[i]<0 || label[i]>3)
  36. printf ("ERROR: Label corrupted.n");
  37.  
  38. for (t=0; t<b_length; t++){
  39. dpt[i][t+a_length] = 0.0;
  40. dpt[i][label[i]+a_length] = 1.0;
  41. }
  42. }
  43. fclose (in);
  44. }
  45.  
  46. Program received signal SIGABRT, Aborted.
  47.  
  48. #0 0x00007fff8c12582a in __kill ()
  49. #1 0x00007fff871a3b6c in __abort ()
  50. #2 0x00007fff871a0070 in __stack_chk_fail ()
  51. #3 0x000000010000175f in load_dat ()
  52. #4 0x0000000100001baa in main ()
  53. #5 0x00000001000013e4 in start ()
  54.  
  55. ==22688==
  56. ==22688== Process terminating with default action of signal 6 (SIGABRT)
  57. ==22688== at 0x2DD82A: __kill (in /usr/lib/system/libsystem_kernel.dylib)
  58. ==22688== by 0x18A06F: __stack_chk_fail (in /usr/lib/system/libsystem_c.dylib)
  59. ==22688== by 0x10000175E: load_dat (in ./dataPre)
  60. ==22688== by 0x100001BA9: main (in ./dataPre)
  61. ==22688==
  62. ==22688== HEAP SUMMARY:
  63. ==22688== in use at exit: 28,781 bytes in 83 blocks
  64. ==22688== total heap usage: 84 allocs, 1 frees, 32,877 bytes allocated
  65. ==22688==
  66. ==22688== LEAK SUMMARY:
  67. ==22688== definitely lost: 0 bytes in 0 blocks
  68. ==22688== indirectly lost: 0 bytes in 0 blocks
  69. ==22688== possibly lost: 0 bytes in 0 blocks
  70. ==22688== still reachable: 28,781 bytes in 83 blocks
  71. ==22688== suppressed: 0 bytes in 0 blocks
  72. ==22688== Reachable blocks (those to which a pointer was found) are not shown.
  73. ==22688== To see them, rerun with: --leak-check=full --show-reachable=yes
  74. ==22688==
  75. ==22688== For counts of detected and suppressed errors, rerun with: -v
  76. ==22688== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
  77. Abort trap: 6
  78.  
  79. 44 96 3
  80. 0 0 17.57298681 24.18012088 0 24.07599728 0 0 0 19.53417371 22.61467731 15.5650829 18.65720893 21.70631048 26.8811321 23.88086356 23.73544942 0 0 22.63088094 21.11777268 22.06847477 22.38688445 19.6794802 20.95594497 22.56472976 15.5058779 0 16.89366861 21.23974633 0 19.01608872 22.58492673 22.39564384 18.17000387 0 0 25.85404904 23.80483437 22.64271243 0 17.09819014 24.60634479 0 24.74696139 29.27117194 20.8931952 19.08648917 23.95167438 0 0 17.2386599 0 0 23.22304254 22.86712074 0 21.45687449 21.45146304 0 0 0 20.98717232 0 18.09871479 17.8226754 23.72508288 23.34563846 21.26201041 17.44038043 22.49848573 18.99848797 16.43222002 14.8132735 22.28093734 17.78931496 0 20.46914933 17.87742323 21.07936723 23.52102135 0 17.90498094 21.93199281 0 0 16.3020812 0 18.17972854 16.43234906 19.0756696 0 0 22.98048214 23.22184013 21.54024161 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement