Why only first character of string is writing into .csv file
Mostra commenti meno recenti
In my project i would like to write strings form array to .csv file. But it can writes only first character of the string.
my code is
clc
n=1;
Fe={'A';'B';'C';'D';'E';'F';'G';'H';'I';'J';'K';'L';'M';'N';'O';'P';'Q';'R';'S';'T';'U';'V';'W';'X';'Y';'Z';'AA';'AB';'AC';'AD';'AE';'AF';'AG';'AH';'AI';'AJ';'AK';'AL';'AM';'AN';'AO';'AP';'AQ';'AR';'AS';'AT';'AU';'AV';'AW';'AX';'AY';'AZ';'BA';'BB';'BC';'BD';'BE';'BF';'BG';'BH';'BI';'BJ';'BK';'BL';'BM';'BN';'BO';'BP';'BQ';'BR';'BS';'BT';'BU';'BV';'BW';'BX';'BY';'BZ';'CA';'BB';'CC';'CD';'CE';'CF';'CG';'CH';'CI';'CJ';'CK';'CL';'CM';'CN';'CO';'CP';'CQ';'CR';'CS';'CT';'CU';'CV';'CW';'CX';'CY';'CZ';'DA';'DB';'DC';'DD';'DE';'DF';'DG';'DH';'DI';'DJ';'DK';'DL';'DM';'DN';'DO';'DP';'DQ';'DR';'DS';'DT';'DU';'DV';'DW';'DX';'DY';'DZ';'EA';'EB';'EC';'ED';'EE';'EF';'EG';'EH';'EI';'EJ';'EK';'EL';'EM';'EN';'EO';'EP';'EQ';'ER';'ES';'ET';'EU';'EV';'EW';'EX';'EY';'EZ';'FA';'FB';'FC';'FD';'FE';'FF';'FG';'FH';'FI';'FJ'};
Fa= {'AA','AB','AC'};
fn='1_LET.csv';
n=n+1;
for i=25:30
for j=1:1
cellRef_0 = sprintf('A%d:A%d',n,n);
cellRef1 = sprintf('B%d:CH%d',n,n);
cellRef2 = sprintf('CI%d:EK%d',n,n);
x1 = imread(sprintf('D:/img/%d/%d.bmp',i,j));
xlswrite(fn,Fe{i},cellRef_0);
feature_extractor(x1);
xlswrite(fn,ans',cellRef1);
feature_extractor_2d(x1);
xlswrite(fn,ans',cellRef2);
n=n+1;
end
fprintf( 'completed of %d\n',i );
end
1 Commento
You should learn to pay attention to the warnings in the MATLAB code editor:

What does ans refer to? It is not clear at all from your code. It makes it impossible for us to test your code.
Also the indentation is inconsistent, making it hard to follow the code logic. When you use consistent code indentation then it makes it easier to understand the code, which makes it easier to write code without bugs.
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Characters and Strings in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!