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 Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by