Writing strings in excel using matlab?

I am writing an array of row cells in Excel from Matlab. I have cell array data {} which I am trying to write to Matlab. It must type three large line lengths in order to succeed, since strcmp goes 3 times. Currently, it only writes the last rowset in excel. data = {{1x25} {1x35} {1x20}} is as follows. In addition, I would like to be able to write data to three cells instead of copying them to so many cells that there are rows in the cell array element. Is it possible to outperform with Matlab?

done = {}

for i = 1:3
   q = strcmp(x_gene_ID{i},locus_tags{i});
   if q ==1
       done{end+1} = data{i};
       disp(done);

   end


end


w = xlswrite('data.xlsx',done','E2:E400');

, , 3- . Nx1 Excel, . ?

A     B      C        D                   E  
w   Rv0146  na  Rv0039c (i want the cell array1 to go here)
s   Rv0156  na  Rv0029c (i want the cell array2 to go here)
s   Rv0156  na  Rv0029c (i want the cell array2 to go here)

excel

+3
1

:

, , data - , 1--N (, , N--1). , .

, , :

data = {{'hello' 'hi' 'hey'} ...              %# Sample cell array of 1-by-N
        {'world' 'earth' 'everyone'} ...      %#   cell arrays of strings
        {'blah' 'blah'}};
data = cellfun(@(x) {strcat(x,{char(10)})},data);  %# Add newline characters
                                                   %#   to the string ends
data = cellfun(@(x) {deblank([x{:}])},data);  %# Concatenate the inner cells and
                                              %#   remove the trailing newlines 

, , Excel :

xlswrite('data.xls',data(:),'Sheet1','E2');  %# Write the data to cells E2 to E4

:

alt text

' ', ( ):

alt text

, : CELLFUN, STRCAT, CHAR, DEBLANK, XLSWRITE.

+5

Source: https://habr.com/ru/post/1751457/


All Articles