EDN Admin
Well-known member
Hi Everyone,
I got error when I try compile my code :
Windows has triggered a breakpoint in anisotropic1.exe.<br/>
This may be due to a corruption of the heap, which indicates a bug in anisotropic1.exe or any of the DLLs it has loaded.<br/>
This may also be due to the user pressing F12 while anisotropic1.exe has focus.<br/>
The output window may have more diagnostic information.
Below is my code which got error :
SAVE properties :
int save(char path[], float *metu, int L)<br/>
{<br/>
<span style="white-spacere FILE *fp;<br/>
<span style="white-spacere if(!fopen_s(&fp,path,"w+") && L > 0 && metu != NULL)<br/>
<span style="white-spacere {<br/>
<span style="white-spacere fprintf(fp,"%f",metu[0]);<span style="white-spacere
<----<span style="white-spacere ERROR point to this part <br/>
<span style="white-spacere for(int i=0;i<L;i++)<br/>
<span style="white-spacere fprintf(fp,"%fn",metu);<br/>
<span style="white-spacere fclose(fp);<br/>
<span style="white-spacere return L;<br/>
<span style="white-spacere }<br/>
<span style="white-spacere return -1;<br/>
}
<span> Function which call save :
#include "rt_nonfinite.h"<br/>
#include "anisodiff1D.h"<br/>
#include "power.h"<br/>
#include "conv.h"<br/>
#include "load.h"<br/>
#include "save.h"<br/>
<br/>
<br/>
float *input=new float[250];<br/>
real_T bufferout[2500];<br/>
float *out=new float[1250];<br/>
real_T buffer[250];<br/>
<br/>
<br/>
<br/>
<br/>
void anisodiff1D(real_T diff_sig_data[250], int32_T diff_sig_sizes[1])<br/>
{<br/>
int L=load("pulsenoise250.txt",input);<br/>
<br/>
int32_T t;<br/>
int32_T nablaW_sizes;<br/>
real_T nablaW_data[250];<br/>
int32_T nablaE_sizes;<br/>
real_T nablaE_data[250];<br/>
real_T b_nablaW_data[250];<br/>
real_T b_nablaE_data[250];<br/>
int32_T tmp_sizes;<br/>
real_T tmp_data[250];<br/>
int iteration=5;<br/>
int kappa=2.0;<br/>
<br/>
diff_sig_sizes[0] = 250;<br/>
for (int i=0; i<250; i++)<br/>
{<br/>
diff_sig_data=input;<br/>
}<br/>
<br/>
// Anisotropic diffusion. <br/>
for (t = 0; t < iteration; t++) //loop as long as number iteration<br/>
{<br/>
<br/>
conv(diff_sig_data, diff_sig_sizes, nablaW_data, *(int32_T (*)[1])&nablaW_sizes); //do the convolution to distinguish between edge end not<br/>
<span style="white-spacere b_conv(diff_sig_data, diff_sig_sizes, nablaE_data, *(int32_T (*)[1])&nablaE_sizes);<br/>
<span style="white-spacere <br/>
//}<br/>
// Diffusion function. <br/>
<br/>
<br/>
nablaW_sizes = 250;<br/>
for (nablaE_sizes = 0; nablaE_sizes < 250; nablaE_sizes++) // the coefficient<br/>
<span style="white-spacere {<br/>
b_nablaW_data[nablaE_sizes] = nablaW_data[nablaE_sizes] / kappa;<br/>
<span style="white-spacere //printf("%fn",b_nablaW_data[nablaE_sizes]);<br/>
b_nablaE_data[nablaE_sizes] = nablaE_data[nablaE_sizes] / kappa;<br/>
}<br/>
<br/>
<span style="white-spacere // function to get exp(-(nablaW/kappa).^2)<br/>
power(b_nablaW_data, *(int32_T (*)[1])&nablaW_sizes, tmp_data, *(int32_T (*)[1])&tmp_sizes);<br/>
power(b_nablaE_data, *(int32_T (*)[1])&nablaE_sizes, b_nablaW_data, *(int32_T (*)[1])&tmp_sizes);<br/>
<br/>
<br/>
<span style="white-spacere // Discrete PDE solution. <br/>
<span style="white-spacere diff_sig_sizes[0] = 250;<br/>
<span style="white-spacere nablaE_sizes=0;<br/>
<span style="white-spacere while(nablaE_sizes<250)<br/>
<span style="white-spacere { <br/>
<span style="white-spacere diff_sig_data[nablaE_sizes] = diff_sig_data[nablaE_sizes]+ (1/3) * (((1.0 / (1.0 +tmp_data[nablaE_sizes]) * nablaW_data[nablaE_sizes] + 1.0 / (1.0 +b_nablaW_data[nablaE_sizes]) * nablaE_data[nablaE_sizes]))+(input[nablaE_sizes]-diff_sig_data[nablaE_sizes]));<br/>
<span style="white-spacere nablaE_sizes++;<br/>
<br/>
}<br/>
<span style="white-spacere for(int a=0;a<250;a++)<br/>
<span style="white-spacere {<br/>
<span style="white-spacere bufferout[a]=diff_sig_data[a];<br/>
<span style="white-spacere }<br/>
<span style="white-spacere memcpy((void *)&out[0], (void *)&bufferout[0], 1250U * sizeof(real_T));<br/>
<span style="white-spacere save("outputpulse250.txt",out,1250);<br/>
}<br/>
<br/>
}<br/>
<br/>
View the full article
I got error when I try compile my code :
Windows has triggered a breakpoint in anisotropic1.exe.<br/>
This may be due to a corruption of the heap, which indicates a bug in anisotropic1.exe or any of the DLLs it has loaded.<br/>
This may also be due to the user pressing F12 while anisotropic1.exe has focus.<br/>
The output window may have more diagnostic information.
Below is my code which got error :
SAVE properties :
int save(char path[], float *metu, int L)<br/>
{<br/>
<span style="white-spacere FILE *fp;<br/>
<span style="white-spacere if(!fopen_s(&fp,path,"w+") && L > 0 && metu != NULL)<br/>
<span style="white-spacere {<br/>
<span style="white-spacere fprintf(fp,"%f",metu[0]);<span style="white-spacere
<----<span style="white-spacere ERROR point to this part <br/>
<span style="white-spacere for(int i=0;i<L;i++)<br/>
<span style="white-spacere fprintf(fp,"%fn",metu);<br/>
<span style="white-spacere fclose(fp);<br/>
<span style="white-spacere return L;<br/>
<span style="white-spacere }<br/>
<span style="white-spacere return -1;<br/>
}
<span> Function which call save :
#include "rt_nonfinite.h"<br/>
#include "anisodiff1D.h"<br/>
#include "power.h"<br/>
#include "conv.h"<br/>
#include "load.h"<br/>
#include "save.h"<br/>
<br/>
<br/>
float *input=new float[250];<br/>
real_T bufferout[2500];<br/>
float *out=new float[1250];<br/>
real_T buffer[250];<br/>
<br/>
<br/>
<br/>
<br/>
void anisodiff1D(real_T diff_sig_data[250], int32_T diff_sig_sizes[1])<br/>
{<br/>
int L=load("pulsenoise250.txt",input);<br/>
<br/>
int32_T t;<br/>
int32_T nablaW_sizes;<br/>
real_T nablaW_data[250];<br/>
int32_T nablaE_sizes;<br/>
real_T nablaE_data[250];<br/>
real_T b_nablaW_data[250];<br/>
real_T b_nablaE_data[250];<br/>
int32_T tmp_sizes;<br/>
real_T tmp_data[250];<br/>
int iteration=5;<br/>
int kappa=2.0;<br/>
<br/>
diff_sig_sizes[0] = 250;<br/>
for (int i=0; i<250; i++)<br/>
{<br/>
diff_sig_data=input;<br/>
}<br/>
<br/>
// Anisotropic diffusion. <br/>
for (t = 0; t < iteration; t++) //loop as long as number iteration<br/>
{<br/>
<br/>
conv(diff_sig_data, diff_sig_sizes, nablaW_data, *(int32_T (*)[1])&nablaW_sizes); //do the convolution to distinguish between edge end not<br/>
<span style="white-spacere b_conv(diff_sig_data, diff_sig_sizes, nablaE_data, *(int32_T (*)[1])&nablaE_sizes);<br/>
<span style="white-spacere <br/>
//}<br/>
// Diffusion function. <br/>
<br/>
<br/>
nablaW_sizes = 250;<br/>
for (nablaE_sizes = 0; nablaE_sizes < 250; nablaE_sizes++) // the coefficient<br/>
<span style="white-spacere {<br/>
b_nablaW_data[nablaE_sizes] = nablaW_data[nablaE_sizes] / kappa;<br/>
<span style="white-spacere //printf("%fn",b_nablaW_data[nablaE_sizes]);<br/>
b_nablaE_data[nablaE_sizes] = nablaE_data[nablaE_sizes] / kappa;<br/>
}<br/>
<br/>
<span style="white-spacere // function to get exp(-(nablaW/kappa).^2)<br/>
power(b_nablaW_data, *(int32_T (*)[1])&nablaW_sizes, tmp_data, *(int32_T (*)[1])&tmp_sizes);<br/>
power(b_nablaE_data, *(int32_T (*)[1])&nablaE_sizes, b_nablaW_data, *(int32_T (*)[1])&tmp_sizes);<br/>
<br/>
<br/>
<span style="white-spacere // Discrete PDE solution. <br/>
<span style="white-spacere diff_sig_sizes[0] = 250;<br/>
<span style="white-spacere nablaE_sizes=0;<br/>
<span style="white-spacere while(nablaE_sizes<250)<br/>
<span style="white-spacere { <br/>
<span style="white-spacere diff_sig_data[nablaE_sizes] = diff_sig_data[nablaE_sizes]+ (1/3) * (((1.0 / (1.0 +tmp_data[nablaE_sizes]) * nablaW_data[nablaE_sizes] + 1.0 / (1.0 +b_nablaW_data[nablaE_sizes]) * nablaE_data[nablaE_sizes]))+(input[nablaE_sizes]-diff_sig_data[nablaE_sizes]));<br/>
<span style="white-spacere nablaE_sizes++;<br/>
<br/>
}<br/>
<span style="white-spacere for(int a=0;a<250;a++)<br/>
<span style="white-spacere {<br/>
<span style="white-spacere bufferout[a]=diff_sig_data[a];<br/>
<span style="white-spacere }<br/>
<span style="white-spacere memcpy((void *)&out[0], (void *)&bufferout[0], 1250U * sizeof(real_T));<br/>
<span style="white-spacere save("outputpulse250.txt",out,1250);<br/>
}<br/>
<br/>
}<br/>
<br/>
View the full article