Azzera filtri
Azzera filtri

Format of xlsread output

2 visualizzazioni (ultimi 30 giorni)
Will
Will il 17 Mag 2017
Commentato: Walter Roberson il 18 Mag 2017
Hello all,
A simple question: if I were to read an excel workbook's cells, one of them which contained a literal string in this format:
{ISM_PKExteriorScanReq = NTI_PKExteriorScanReq}
[ISM_PEnable && ISM_PKExteriorScanReq==2]
{SCH_Fob_Found=x;
SCH_Finished=ISTRUE;
SCH_callTEA=ISTRUE;}
The output for the particular cell would like identical to what it read. Is there any special characters or something that is hidden in this text though (such as newlines)? So, for example, if there were hidden characters, using a regexp function:
match = regexp(text, regexptranslate('escape', text), 'match');
match would be an empty cell array. In my case, match is an empty cell array.

Risposte (1)

Walter Roberson
Walter Roberson il 17 Mag 2017
If that is a single cell, then Yes, there would have to be characters other than the obvious, or else the output formatting would be different.
You can find the unexpected characters using
badchar_mask = ~isstrprop(text, 'print');
text(badchar_mask) + 0
  2 Commenti
Will
Will il 18 Mag 2017
Thank you for the help.
I tried this code, but it did not work (seemingly). My actual problem is comparing two strings, where one string is a substring of the other. For example, here are the two strings:
[(Check_Timer_Msec(ELM_ELTCHLR_TMR_MSEC_INDEX) >= ...
NVM_ELatchTriggerTimeout) || ...
ISM_ELMBatteryState != BATT_OKAY]
{ELM_locelatchenable = ELM_IDLE;}
[(Check_Timer_Msec(ELM_ELTCHLR_TMR_MSEC_INDEX) >= ...
NVM_ELatchTriggerTimeout) || ...
ISM_ELMBatteryState != BATT_OKAY]
{ELM_locelatchenable = ELM_IDLE;}
{!((NTI_DoorLatchStatus & door_temp)==door_temp) || ...
(NTI_CentralLockStatus ==2 || NTI_CentralLockStatus==3 || NTI_CentralLockStatus==4)]
As you can see, the first string is an exact substring in the second string. I simply want to compare these two string and have a true or false output (in this case, it should be true). However, whatever method I use to compare the two (strfind, regexp, etc), the function says there is no match. Examples of these uses are below:
check = regexp(string2, regexptranslate('escape', string1), 'match');
check = strfind(string2, string1);
check = strfind(string2, regexptranslate('escape', string1));
None of the above methods work. There are indeed hidden new line characters, and I thought this may be the problem, but I am not sure.
Any help would be appreciated.
Walter Roberson
Walter Roberson il 18 Mag 2017
Are you indicating that the output of text(badchar_mask) + 0 was empty?
Could you post double() of each of the strings?

Accedi per commentare.

Categorie

Scopri di più su Characters and Strings in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by