Convert cell array to matrix to be able to export to excel
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
if true
SaveFileName = 'Sus-Ih5';
% Get Cell selection file
[FileName,PathName] = uigetfile('*.xlsx','Select Excel file','MultiSelect','on'); % get filename
FFN = [PathName FileName];
data_fid = fopen(FFN,'rt');
PathName=[PathName 'signal files\'];
cfsdir=PathName;
% Determine how many sheets are in the selection file
[bla,sheets]=xlsfinfo(FFN);
NumSheets=numel(sheets);
%For all sheets do
for jj = 1:numel(sheets)
Excel=[];
Sheet=sheets{jj}; %Convert sheet name in string
[Excel,bla]=xlsread(FFN,Sheet); %Read content Selection File
[CellNum bla]=size(Excel); %Determine number of cells
for ii = 1:CellNum
% Clear variables
input=[];
% Read File
fName=sprintf('MA%3.3d_%3.3d.cfs',Excel(ii,1),Excel(ii,2)); %Make data filename
input=ReadCFSFile(cfsdir, fName, chan_num,0); % Dir, FileName, Records (0=all)
disp([ 'File Name: ' fName]);
A(:,ii,jj)= { input.current(:,1003:3003)};
end
v = cell2mat(A)
% xlswrite(fullfile(PathName,SaveFileName),A(:,:,:),Sheet,'A1');
end
end
So this is the code I am working on, this files, have 5 traces (2000 points each). I need to extract part of the data from some cells, later on subtract one cell in one condition to another. so I created A a 1x6 cell. Inside there is 6 5x2000 matrix I want to use. I want to transform the cell into matrix, 30x2000 (in this case because there are 6 cells to analyze) or something like that, so I can do it for all, later subtract.
cell2mat(A) just transforms it 5x120006 or something like that and I can't use it. Could anybody help.
I am sorry I am very new to this coding thing.
2 comentarios
KSSV
el 28 de Jun. de 2017
cell's can straight away written to excel. You need not to convert them to matrix.
Respuestas (0)
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!