How can I properly index a table using isnan? (R2020a)

38 views (last 30 days)
I am writing multiple tables to an Excel spreadsheet, and do not want previously added tables to be overwritten. As such, I have created the following code. The variable R is a 14x11 table completely filled with NaN as my stated readtable range in Excel is currently empty. I have preceding code which uses manually specified filepaths to extract data from files and create the tables.
R = readtable('rangedata.xlsx',...
if isnan(R(1,1))
elseif isnan(R(1,4))
elseif isnan(R(1,7))
else, isnan(R(1,10))
When running the script, I encounter the error "Check for missing argument or incorrect argument data type in call to function 'isnan'." I have tried changing all my index formatting to the following format, where Var1 is the name of the first variable, but that has not worked either.
if isnan(R(1,{'Var1'}))

Accepted Answer

Peng Li
Peng Li on 28 Mar 2020
Either use dot notion or {} pair to access a table element.
Try R.Var1(1) for example.

More Answers (0)


Find more on Argument Definitions 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!

Translated by