Exporting string data from a structure array to a cell in Excel worksheet .
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
sanchit ingale
le 24 Mai 2017
Commenté : sanchit ingale
le 24 Mai 2017
I have written a program for automatic scoring for some CAD images. The problem I am currently facing is I am not able to export the name of the image file and the corresponding score to the same Excel worksheet. I have attached my code below. Also the string data in 'f' is not being stored in a single cell. How to do that ?
% Grade Multiple Files at Once
clc;
clear all;
Dir = 'C:\Users\Sanchit\Desktop\IDETC - Copy\Models\Flange\2D';
% Read images from Images folder
files = dir(fullfile(Dir, '*.png'));
for j=1:length(files)
Img = imread(fullfile(Dir, files(j).name)); % Read images from folder
I(j)=Flangenew(Img); % Grade files in the folder
end
f=[files(:).name]'
xlswrite('results', I');
xlswrite('filenames',f);
0 commentaires
Réponse acceptée
Walter Roberson
le 24 Mai 2017
% Grade Multiple Files at Once
Dir = 'C:\Users\Sanchit\Desktop\IDETC - Copy\Models\Flange\2D';
% Read images from Images folder
files = dir(fullfile(Dir, '*.png'));
nfiles = length(files);
I = cell(nfiles+1, 2);
I{1,1} = 'File Name'; %column headers
I{1,2} = 'Score';
for j = 1:nfiles
thisfile = files(j).name;
Img = imread(fullfile(Dir, thisfile)); % Read images from folder
I{j+1, 1} = thisfile;
I{j+1, 2} = Flangenew(Img); % Grade files in the folder
end
xlswrite('results', I);
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur String Parsing 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!