Opening another array of data
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
So here's my code so far
folder = 'C:\\Users\emma\Documents\CORES\EXCEL\';
ff = 'SAFLCore*_GrainSize.xlsx';
names = dir(fullfile(folder,ff))
filename = {names.name}
for ii = 1:numel(filename)
f = fullfile(folder, filename{ii});
[status, sheets] = xlsfinfo(f);
result = [];
for k = 1:numel(sheets)
result{k,1} = xlsread(f,sheets{k})
end
out{ii} = result
n = length(out{ii});
end
Now, I am trying to open up the "out" result which have rows of varying columns and sheets. How do I open up another array of data?
I have this so far:
for aa = 1:n
data = out;
end
Not sure if I'm explaining this well. I want to be able to open up the {17x1}, {14x1}, and {16x1} cells that the "out = result" gives. Each of those columns have their own set of more {17x3}, {17x2}, etc array of data.
HARD TO EXPLAIN, sorry please send help
2 commentaires
Bob Thompson
le 2 Août 2016
If I understand what you have written correctly, then you have out{1} containing a {17x1}, out{2} containing {14x1}, etc.
If that is the case then if you want to get data to be equal to one of those interior array's (such that data is {17x1}), then just set data = out{1}.
If that is not what's going on then you must be overwriting out each time, in which case would creating an extra layer to be able create such a setup as I have mentioned work?
Don't know if what I'm saying makes sense, I find it difficult to talk about cell arrays without interactive graphics.
Réponses (1)
Bob Thompson
le 2 Août 2016
Modifié(e) : Image Analyst
le 25 Nov 2016
So you want to open the cell within the cell array? Generally that's done by something like the following:
out{FirstLayer}{SecondLayer}{ThirdLayer}{Etc.}
You may have to mess around with using regular parentheses, (), depending on the format you want have the information in 'data' to be. If you do use the regular parentheses, it will only be on the last layer that you are trying to look at.
Ex.
out = cell(3,1)
out = {[17x3];
[17x4];
[17x3]};
% to set data = the first [17x3] array use
data = zeros(17,3);
data(:,:) = out(1);
% here you want to use the () because you want the contents of cell (1,1) of the 'out' array.
% if you wanted a certain part of the first [17x3] use this
data = out{1}(1,1);
% this chooses the top left number of the first cell in the 'out' array.
Let me know if that was more helpful.
0 commentaires
Voir également
Catégories
En savoir plus sur Data Type Conversion dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!