删除一条线从一个结构体

70(30天)
何塞·佩雷拉
何塞·佩雷拉 2017年12月9日
评论道: 图像分析 2020年1月9日
嗨,我有一个与9线和4领域的结构。我如何删除第4行吗?

答案(2)

图像分析
图像分析 2017年12月9日
看到 这个链接
从结构使用rmfield删除字段()。例如,如果结构叫做mystruct和field1字段,field2, field3, field4
mystruct。field1 = rand ();
mystruct。field2 = rand ();
mystruct。field3 = rand ();
mystruct。field4 = rand ();
你想要删除的字段名为“field4”你可以做
mystruct = rmfield (mystruct,“field4”);
结构没有行, 除非你的意思是,一个规范的线(像一个矢量点,或一个斜率和截距)存储在一个字段中。

MeLearningProgramming
MeLearningProgramming 2020年1月9日
结构可以有台词:如果你有
mystruct (1)。field1 = rand ();
mystruct (1)。field2 = rand ();
mystruct (1)。field3 = rand ();
mystruct (1)。field4 = rand ();
…直到
mystruct (9)。field1 = rand ();
mystruct (9)。field2 = rand ();
mystruct (9)。field3 = rand ();
mystruct (9)。field4 = rand ();
您可以删除一行是这样的:
mystruct (4) = [];
1评论
图像分析
图像分析 2020年1月9日
那将会非常非标准术语。你显示 结构数组 因为它是单维的,或者向量。这是一个向量,其中每个元素是一个结构。和每一个结构数组中的一个 元素 的向量。我从来没有听到有人叫它 。例如,使用双矢量=[1、2、3、4、5),我从来没有听到有人叫第四元素“线”。但也许这就是楼主的意思。

登录置评。

标签

社区寻宝

找到宝藏在MATLAB中央,发现社区如何帮助你!

开始狩猎!