it培训机构排行榜,抖音seo软件工具,山东集团网站建设 中企动力,东城网站建设哪家好直奔主题#xff0c;需要保存处理图像的文件名(string)数组。本文只用作自己的实验记录#xff0c;侵删。搬运自matlab官网的代码#xff1a;https://www.mathworks.com/matlabcentral/fileexchange/7601-cell2csv?s_tidmwa_osa_a以下为MATLAB cell array to csv的函数实现…直奔主题需要保存处理图像的文件名(string)数组。本文只用作自己的实验记录侵删。搬运自matlab官网的代码https://www.mathworks.com/matlabcentral/fileexchange/7601-cell2csv?s_tidmwa_osa_a以下为MATLAB cell array to csv的函数实现function cell2csv(filename,cellArray,delimiter)% Writes cell array content into a *.csv file.%% CELL2CSV(filename,cellArray,delimiter)%% filename Name of the file to save. [ i.e. text.csv ]% cellarray Name of the Cell Array where the data is in% delimiter seperating sign, normally:, (its default)%% by Sylvain Fiedler, KA, 2004% modified by Rob Kohr, Rutgers, 2005 - changed to english and fixed delimiterif nargin3delimiter ,;enddatei fopen(filename,w);for z1:size(cellArray,1)for s1:size(cellArray,2)var eval([cellArray{z,s}]);if size(var,1) 0var ;endif isnumeric(var) 1var num2str(var);endfprintf(datei,var);if s ~ size(cellArray,2)fprintf(datei,[delimiter]);endendfprintf(datei,\n);endfclose(datei);我的调用代码实例clc;clear all;path E:\DZY\CASIA\train\2\;fileFolder fullfile(path);dirOutput dir(fullfile(fileFolder,*.jpg));fileNames {dirOutput.name};list string(fileNames);n length(fileNames);Train_images [];% 创建字符串数组Train_names strings;for i 1:n% 拼接图片的路径pic_path strcat(path, list(i));pic_path char(pic_path);% fk1是自己写的特征提取代码返回一个1*256的特征向量lpq_gray fk1(pic_path);% 组成样本集Train_images(i,:) lpq_gray;Train_names(i,:) list(i);disp(processing : string(pic_path));end% 存储文件名save_path_data E:\DZY\CASIA\ycbcr\Test0.csv;save_path_name E:\DZY\CASIA\ycbcr\Test0_name.csv;csvwrite(save_path_data,Train_images);%将文件名数组保存cell2csv(save_path_name, Train_names, ,);