小编use*_*988的帖子

将2个字节转换为整数

我收到一个端口号为2个字节(最低有效字节优先),我想将它转换为一个整数,以便我可以使用它.我做了这个:

char buf[2]; //Where the received bytes are

char port[2];

port[0]=buf[1]; 

port[1]=buf[0];

int number=0;

number = (*((int *)port));
Run Code Online (Sandbox Code Playgroud)

但是,有一些错误,因为我没有得到正确的端口号.有任何想法吗?

c byte integer type-conversion

14
推荐指数
3
解决办法
4万
查看次数

在MATLAB中绘制体积数据

我在Matlab工作,我有一个尺寸为384x512x160的3d矩阵,由384x512切片组成.

我该如何绘制这样的数据?

3d matlab plot visualization 3d-reconstruction

6
推荐指数
1
解决办法
2282
查看次数

轮廓中等距的点

我有一组 2D 点(未排序)形成闭合轮廓,我想将它们重新采样为 14 个等距点。它是图像上肾脏的轮廓。有任何想法吗?

matlab interpolation image-processing points contour

4
推荐指数
1
解决办法
2501
查看次数

将数据从int复制到2个无符号字符

如何将数据从int(int port1 = 52010)复制到一对无符号字符(unsigned char port2[2]?我不知道如何处理除法.

c int unsigned-char

1
推荐指数
1
解决办法
199
查看次数