Recognizing empty spaces in excel file

5 次查看(过去 30 天)
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