Invalid expression.Unable to resolve the name

7 views (last 30 days)
Hello
[num,txt,raw] = xlsread('SummaryResult.xlsx','AAA_SheetName');
newlyAdded = readtable('SummaryResult.xlsx', 'Sheet', ''AAA_SheetName','Range','A2:D40','TextType','string');
NewData = num2str(t.BLFFileName)+"_"+num2str(t.Time_sec_);
As Excel is having Column name as "BLF File Name". As it is having space between the words. Unble to read the space.
Unable to resolve the name c.BLFFileName.
Error: Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax
error. To construct matrices, use brackets instead of parentheses.
I tried with different expression as
num2str(t.('BLF File Name'))+"_"+num2str(t.Time_sec_);
num2str(t.('BLFFileName'))+"_"+num2str(t.Time_sec_);
num2str(t.('BLF_File_Name'))+"_"+num2str(t.Time_sec_);
num2str(t.'BLF_File_Name')+"_"+num2str(t.Time_sec_);
num2str(t.(BLF_File_Name))+"_"+num2str(t.Time_sec_);
for all, showing same error msg.
Thank you
Brief Work
Please let me know for brief.

Accepted Answer

Walter Roberson
Walter Roberson on 2 Aug 2022
in your r2019b release add the readable option 'PreserveVariableNames', true
and use t.('BLF File Name')
Note that PreserveVariableNames option was changed in a later release to 'VariableNamingRule', 'preserve'

More Answers (0)

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!