How to create a 6 dimension array in Matlab and store values in it
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Shakeel alvi
am 24 Okt. 2020
Kommentiert: Shakeel alvi
am 24 Okt. 2020
I have 8-relay , which i want to represent by x and y coordinates , then store 4 attribues of each of these relay , these attribues are generated randomly
for example relay no 1. at x=2 and y=7 ,
has power =5,
buffer total =1000, SINR=20 ,
Packets in buffer = 100
0 Kommentare
Akzeptierte Antwort
John D'Errico
am 24 Okt. 2020
Bearbeitet: John D'Errico
am 24 Okt. 2020
It very much depends on what you want to do with that data. But I think you are looking for a very inefficient way to store your information.
You might, for example, use a THREE dimensional array.
x = 2;
y = 7;
INFO(x,y,[1:4]) = [5 1000 20 100];
So in the (2,7) location, we see the data has been stored as desired.
squeeze(INFO(2,7,:))
INFO(2,7,1)
INFO(2,7,2)
So no need to think about 6 dimensions.
Another idea, is to treat a 2-d array as essentially a database.
INFO = [2 7 5 1000 20 100];
So each row of INFO is one piece of information. You can now sort things on any of the variables.
Perhaps better yet is to use a table. Now you can name the variables. Or, you could use structs. The point is, there are so many ways you can store the data, that do not force you to create 6 dimensional arrays.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!