Plz explain the operation

[~, ~, 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

 Risposta accettata

Cedric
Cedric il 10 Apr 2013

0 voti

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.

Più risposte (1)

Azzi Abdelmalek
Azzi Abdelmalek il 9 Apr 2013

0 voti

Read a cell raw from an Excel file then replace all numeric values, nan and empty element by ' '

Community Treasure Hunt

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

Start Hunting!

Translated by