M file to get a column string of rows from MatLab/Octave to Excel/OpenOfficeCalc

M file to get a column string of rows from MatLab/Octave to Excel/OpenOfficeCalc.

This program asks you the grade of rows you need, and its number, and it brings a column of the rows you need to operate. Works pretty well when working with nets in which you need to add data from columns + rows at the same time. You copy a row to a column, and you can procceed. Spanish display. Working on both translations.

function [FaC] = CFsw
%CFsw cambia filas por columnas en una cadena para excel
%cambiar columnas por filas en otra línea
% ascii = char(reshape(11:130, 10, 12)');
clc; FaC = []; cond = 0;

disp('Introduzca como cadena, el/los número(s)...')
F_FaC = input('de la fila a trasponer:  ');

disp('Introduzca como cadena, la letra...')
C_i = input('de la columna inicial:  ');
if length(C_i) > 1
    error('Nombre de columna inicial demasiado largo')
end

disp('Introduzca como cadena, la(s) letra(s)...')
C_f = input('de la columna final:  ');
if length(C_f) == 2
    n_C_f = (single(C_f(1))-64)*26 + single(C_f(2));
    C = single(C_i);
 
    while C < n_C_f
    if cond == 0
    for C = single(C_i):90; FaC(C-C_i+1,:) = [' ','=',C,F_FaC]; end %#ok<AGROW>
    cond = 1;
    end
 
    if cond == 1
    for k = 65:single(C_f(1))
        for l = 65:90
        C = C+1; FaC(C-C_i+1,:) = ['=',k,l,F_FaC]; %#ok<AGROW>
        %usar rem(C,90) como resto div?
        if C >= n_C_f; break; end
        end
    end
    end
    end
 
    FaC = char(FaC);
 
elseif length(C_f) == 1
    for C = single(C_i):single(C_f)
    FaC(C-C_i+1,:) = ['=',C,F_FaC]; %#ok<AGROW> %Columnas a Filas
    end
    FaC = char(FaC);
 
else
    error('Nombre de columna demasiado largo')
end

end


No hay comentarios: