Effacer les filtres
Effacer les filtres

How to store this data in array..

3 vues (au cours des 30 derniers jours)
joy
joy le 7 Jan 2015
Modifié(e) : Stephen23 le 7 Jan 2015
Hi all,
I have a variable which could have following dimension at different instant
say,
c=6*5 , 7*6, 7*7, 7*8
how could I store c value in an array..
so that if I call c(1) it would give data set of 6*5 dimension for c(2) it would be 7*6 data-set..

Réponse acceptée

Stephen23
Stephen23 le 7 Jan 2015
Modifié(e) : Stephen23 le 7 Jan 2015
In MATLAB you can hold differently sized data in a cell array . The data inside can be of any class and of any size, but you need to pay careful attention to the indexing . Here is a simple example that does something like you want to do:
A = {[1,2],[3,4;5,6],[7;8;9]};
The cell array A contains three numeric arrays of different sizes. You can retrieve any one of these arrays using cell indexing:
>> A{2}
ans = [3,4;5,6]
Also note that there are many other useful functions for cell arrays , such as cellfun:
>> cellfun(@numel,A)
ans = [2,4,3]

Plus de réponses (0)

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by