Recognizing empty spaces in excel file

4 visualizaciones (últimos 30 días)
Saeid
Saeid el 25 de En. de 2017
Editada: Guillaume el 25 de En. de 2017
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?

Respuestas (1)

Guillaume
Guillaume el 25 de En. de 2017
Editada: Guillaume el 25 de En. de 2017
[~, ~, 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, :)))

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by