Data not saving in excel spreadsheet.
2 次查看(过去 30 天)
显示 更早的评论
I have a series of values stored in a cell array that I am saving as an excel spreadsheet. The code to make the excel file is working except for the fact that the spreadsheet is empty when opened. I suspect that this is due to the creation of the data earlier in the code. I have used regionprops to calculate the average intensity inside two regions of interest on a number of matrices stored in a cell array. I have saved the resultant cell array, which should be composed of two columns(the ROI) and a number of rows(the matrices), but when i attempt to open it Matlab claims the directory does not exist. The code to calculate this mean intensity is set up to create this cell array of mean intensity values and I cannot tell where the problem may arise.
for i = 1 : numel(Y)
X = Y{i}.*mask;
end
for i = 1 : length(X)
thisImage = X{i}; % Extract matrix from cell array of matrices.
%Get allIGLs for that image.
props = regionprops(thisImage, 'Area', 'MeanIntensity'); %get these properties for each of the cells in the array 1 : length(i)
allAreas = [props.Area]; % the areas are stored in an array
allMeans = [props.MeanIntensity]; % the means are stored in an array
allIGLs = allAreas .* allMeans; % % The average intensity is calculated
caIGLs{i} = allIGLs; % Store IGLs for this image into a cell array called caIGLs
end
My one suspicion was that rather than save each intensity value in its own discreet cell, the intensities were added together (summed) but the code is set up to calculate the intensity from each matrix individually. This suspicion arose as upon changing xlswrite(fullfile(Folder, Name), Cell_Array, Sheet); to xlswrite(fullfile(Folder, Name), Cell_Array{:}, Sheet); when creating the excel, where Cell_Array is the file created using regionprops (caIGLs)
6 个评论
Adam
2017-8-14
You should probably change the title of the question if it is actually about regionprops and nothing to do with the Excel saving. It might get more attention from people who know about using regionprops.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!