Error in string operation
3 ビュー (過去 30 日間)
古いコメントを表示
Runs correctly first time. On second run, says "Error using == Comparison between logical and string is not supported."
What am I not doing right?
% Import file
file = string(extractFileText('my_text.pdf'))
% Break the file into lines
datachunks = splitlines(file)
% Eliminate empty lines
datachunks = datachunks(datachunks == "") % Error here. No change to anything preceeding this line for the second rerun. These 3 lines are literally the first 3 commands.
Thank you for your time in advance.
0 件のコメント
採用された回答
Steven Lord
2020 年 7 月 4 日
My guess is that on a later line of code you overwrite the datachunks variable (which previously contained a string array) with a logical array. If so then the next time you tried to compare it with "" you would receive this error.
>> true == ""
Error using ==
Comparison between logical and string is not supported.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Characters and Strings についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!