Error in string operation
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
klb
el 4 de Jul. de 2020
Comentada: klb
el 4 de Jul. de 2020
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 comentarios
Respuesta aceptada
Steven Lord
el 4 de Jul. de 2020
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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!