How can I save the same array with different names (saving RAM memory)?
Show older comments
I am working with long arrays that are squeezing my RAM memory. These arrays are stored in structures with long names.
I would like to know if it would be possible to have these arrays saved with shorter names but do not use more RAM memory and still conserve their current name. Like a shortcut. It would be great to work with these arrays with a short name for multiple operations such as mean, plot, etc...
For instance:
Struct1.Struct2.Struct3.Struc4a=rand(1e6,1);
Struct1.Struct2.Struct3.Struc4b=rand(1e6,1);
plot(Struct1.Struct2.Struct3.Struc4a,Struct1.Struct2.Struct3.Struc4b)
Currently I am creating new variables and wasting such a precious memory.
Struct1.Struct2.Struct3.Struc4a=rand(1e6,1);
Struct1.Struct2.Struct3.Struc4b=rand(1e6,1);
Var1=Struct1.Struct2.Struct3.Struc4a;
Var2=Struct1.Struct2.Struct3.Struc4b;
plot(Var1,Var2)
I wonder if it would be possible to save this memory, but still be able to store those values with both variables names. Would it be possible to change some value of the original array and have this change applied automatically in the "shortcut"?
Thanks for your attention. Regards.
2 Comments
Rik
on 20 Apr 2017
You could try an anonymous function, but you might have to redefine that each time you change the original structure.
What is the problem you are trying to solve here? Aesthetics?
Francisco cantos
on 20 Apr 2017
Accepted Answer
More Answers (0)
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!