Hi!
I am working with multiple arrays which some are split up and other are not. They are stored in a cell type called output.mat. Now I would like to name each cell (also the cells which are located inside cells) based on the names of existing files. I made the following for this:
files = dir('*.roi');for i=1:length(output) data = importdata(files(i).name); chr = files(i).name; if ~exist(output{i}{i}) save({chr,'.txt'},'output{i}') else for ii=1:length(output{i}{i}); save([chr,'_',ii,'.txt'],'output{i}{i}'); end endend
However it is not working due to the exist function. The problem is that some cells have cells inside them and others don't. If the cell has a cell inside, I'd like to name them 'filename.1' (and 'filename.2' for the second cell inside the cell and so on). If there is just one cell without an extra cell in it, I'd like to name it 'filename'. So first I'd like to determine if a cell has a cell inside it. I used the exist function for this but obviously it doesn't work. Or do I need to extract all the cells first?
Can someone help me with this?
I apologize if the story is a bit vague.
Best Answer