Determine amount of items in Dataset
23 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Cory Dinkle
il 18 Feb 2022
Risposto: Cory Dinkle
il 21 Apr 2022
Hello, I am trying to write a simple script that removes all but the final "item" in a Dataset. Not sure if this would be called an element, so it's "item" in quotes. Attached is an image of a Dataset with 9+ of these items. When I try numel or size, I simply get "1". How do I find the number of items? Thanks in advance!
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/899010/image.png)
0 Commenti
Risposta accettata
Più risposte (1)
Esha Chakraborty
il 21 Feb 2022
Hi Cory,
I understand that you are trying to find the number of elements in a dataset array, say A, and numel(A) returns 1. To find the number of elements, n, in the dataset array A, use prod(size(A)) or numel(A,':',':').
However, the MATLAB “table” data type is recommended to work with heterogenous data instead of the “dataset” data type.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!