How to count field numbers of structure?

484 次查看(过去 30 天)
Please let me know how to count field numbers of structure as below.
Structure.A = zeros(10); Structure.B = zeros(10); Structure.C = zeros(10);
there are 3 fields in structure, and I want to know number '3'.

采纳的回答

KSSV
KSSV 2015-10-16
length(fieldnames(Structure))
  3 个评论
Jan
Jan 2015-10-16
@Jos: I've seen many bugs caused by using length too sloppy. In the current case fieldnames replies a cell vector, such that length is trustworthy here.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Structures 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by