Recognizing empty spaces in excel file

조회 수: 4 (최근 30일)
Saeid
Saeid 2017년 1월 25일
편집: Guillaume 2017년 1월 25일
Imagine a section of an Excel file of the form shown below:
I can already have MATLAB find the values under the column named "AMPLITUDE" using:
[NUMM,STRR,RAWW]=xlsread('FILENAME.xlsx',1);
[ii,jj] = find(strncmpi(RAWW, 'AMPLITUDE',10))
However, I want my array to be limited to the values starting immediately under the Title AMPLITUDE and ending before the next series start (again at Q1, then Omega/Hz etc.). In this case I am only interested at the values between 0,268 and 399,729. How can I limit the reading to this section without explicitly knowing the number of lines containing these values?

답변 (1개)

Guillaume
Guillaume 2017년 1월 25일
편집: Guillaume 2017년 1월 25일
[~, ~, raw] = xlsread(somefile, 1);
[startrow, ~] = find(strncmpi(raw, 'AMPLITUDE', numel('AMPLITUDE')));
endrow = find(cellfun(@(x) ~isstr(x) && isnan(x), raw(startrow:end, startcol)), 1);
selecteddata = raw(startrow:endrow, :)
%or
selecteddata = cell2table(raw(startrow+1:endrow, :), 'VariableNames', matlab.lang.makeValidName(raw(startrow, :)))

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by