Plz explain the operation

4 views (last 30 days)
karthik
karthik on 9 Apr 2013
[~, ~, raw] = xlsread('C:\Users\KARTHIK P K\Desktop\kpk.xls','MT1_PMUtest_RealTimePass','E3:AQ1014');
raw(cellfun(@(x) ~isempty(x) && isnumeric(x) && isnan(x),raw)) = {''};
Explain the operation of the above statements plz

Accepted Answer

Cedric
Cedric on 10 Apr 2013
CELLFUN is called with two arguments: an anonymous function, and a cell array. It applies the anonymous function to each element of the cell array, and outputs an array of the same size as the cell array, whose elements are the function output. The function that you are using takes one argument, locally named x, and returns a logical AND operation (with shortcut) between all test functions that are listed: not ISEMPTY, ISNUMERIC, and ISNAN.
The output of CELLFUN is therefore an array of logicals, that is used to index the cell array raw. Elements of raw targeted by this operation are replaced with a cell that contains an empty string.

More Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 9 Apr 2013
Read a cell raw from an Excel file then replace all numeric values, nan and empty element by ' '

Categories

Find more on Cell Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!