实际上我已经给出了我的代码,但我无法获得预期的输出,任何人都可以告诉我文错的地方? [英] Actually I Have Given My Code Below But I Am Not Able To Get The Expected Output Can Anyone Tell Where I Wen Wrong?

查看:67
本文介绍了实际上我已经给出了我的代码,但我无法获得预期的输出,任何人都可以告诉我文错的地方?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

// z [kl] = kld_conv [round((kl-1)* 1 / pgfactor)+1];

我已经有一个kld_conv [],它由大小的值组成999

sample_length = 80000

我想把kld_conv尊重索引的值放到z_round。



//z[kl]=kld_conv[round((kl-1)*1/pgfactor)+1];
I have already an kld_conv[] ,which consist of values of size 999
sample_length=80000
I want to put the value of kld_conv respected index to z_round.

double *z;
z=(double*)malloc(sample_length* sizeof(double));
double *z_round;
z_round=(double*)malloc(sample_length* sizeof(double));

for(kl=0;kl<sample_length;kl++)
{
z[kl]=(float)((kl-1)*(1/pgfactor));
int index=round(z[kl])+1;
z_round[kl]=kld_conv[index];
//printf("%f\t ",z_round[0][kl]);
} 
//printf("\n\n");



但是z_round的值是全0,它应该是不是。


but the value of z_round is giving all 0 which it should not be.

推荐答案

sample_length只是int值..

我得到的问题解决了pgfactor值错误地分配现在它的工作作为根据要求。
sample_length is just int value ..
And I got the issue solved pgfactor value was wrongly assign now its working as per the requirement.


这篇关于实际上我已经给出了我的代码,但我无法获得预期的输出,任何人都可以告诉我文错的地方?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆