|
rm2 (Mechanical) |
9 Apr 09 0:07 |
Found some code. I will need to change the number of rows depending on the size of the file.
From the data already gathered, I am on a dilema, should I create a separate variable from each column to easly start plotting them or should I work out each of the variables at "data" ? Please take a look to the code and let me know your thoughts. Is it possible to have at the x axis both date/time and Serial Number (obviously, matched) ? how can I change the scale of the y axis ?
function data=dataimport % Import data from DRC_50HP_Stand1_090406.csv % Automatically generated 08-Apr-2009
% Define parameters fileName='C:\Users\Robert\Documents\MATLAB\DRC_50HP_Stand1_090406.csv'; numHeaderLines=7; formatString='%q%q%q%q%f%f%q%f%f%u64%f%f%f%f%f%f%f%f%f%f%f%u64%f%u64%f%f%f%f%u64%f%f%f%f%f%u64%f%f%f%f%f%f%f%f%f%f%f%u64%u64%u64%f%f%f%f%u64%f%f%f%f%f%u64%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f'; numRows=71;
% Read data from file fid=fopen(fileName,'rt'); ignoreColumns=zeros(1,0); columnHeaderRowNumber=4; columnHeaderRowString=textscan(fid,'%s',1,'headerlines',columnHeaderRowNumber-1,'delimiter','\n'); columnHeaderRow=textscan(columnHeaderRowString{1}{1},repmat('%s',1,113),1,'delimiter',','); columnNames=columnHeaderRow; columnNames(ignoreColumns)=[]; dataCell=textscan(fid,formatString,numRows,'headerlines',numHeaderLines-columnHeaderRowNumber,'delimiter',',');
% Convert to 2D Cell data=cell(numRows+1,length(dataCell)); %Preallocate data(1,:)=columnNames; % Start with column names
for k=1:length(dataCell) if iscell(dataCell{k}) % If cell array of strings data(2:end,k)=dataCell{k}; else % If numerical data(2:end,k)=mat2cell(dataCell{k},ones(numRows,1),1); end end status=fclose(fid);
I really appreciate your help, thanks |
|