Convert cell array to matrix to be able to export to excel

1 次查看(过去 30 天)
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 个评论
KSSV
KSSV 2017-6-28
cell's can straight away written to excel. You need not to convert them to matrix.
Milagros ARIETTI
Milagros ARIETTI 2017-6-28
hank you for your answer. I know that, but like I said I try to convert the cell into matrix and it concatenate in a way I can't use them. I need a matrix 30x2000 but I only get 5x12000000 or so numbers. Like I said, there 5 traces 2000 points each. (6 cells in total), So I would like to put (2000,5) next 5 columns the next cell.. etc. I hope I explained myself.

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by