Nawa Dahal
Nawa Dahal

Reputation: 13

Error updating Text

I am using MATLAB to plot the waveforms from the different earthquakes and get a correlation coefficient between the waveforms. I am using the 2014b version. Initially when I run the code, there was no error. However, this error started popping up now.

The warning is as follows:

Warning: Error updating Text. Following is the chain of causes of the error:

 String must have valid interpreter syntax:
Master event waveform: Twaveforms\15. AAC3 SN

Warning: Error updating Text. Following is the chain of causes of the error:

 String must have valid interpreter syntax:
Secondary event waveform: Twaveforms\15. AAC3 SE

AAC3 is one of my 4 stations and SE is a phase

The command I used is:

titleP1=['Secondary event waveform:',' ',Secondfile(57:70),' ',Secondsta,' ',PhaseType];

I tried replacing ':' after the word 'waveform' but failed every time. Does anyone have a good suggestion to help fix this error?

Upvotes: 1

Views: 6358

Answers (2)

user6267394
user6267394

Reputation: 31

You can also turn the interpreter off:

I presume you used

title(titleP1)

try instead:

title(titleP1, 'interpreter', 'none')

Upvotes: 3

rayryeng
rayryeng

Reputation: 104474

That error is pretty clear. The string contained in Secondfile contains a \. Titles in plots can interpret LaTeX syntax and you prepend a \ before the LaTeX command. What's happening here is that it is trying to interpret the command \15, which is an undefined LaTeX command.

As such, you need to change Secondfile so that it either doesn't contain the \ character, or if you really must, add a second \ so that it can be interpreted as a \ character when displaying the title (i.e. \\).

I'm assuming you want the latter option, so you can try doing something like this to add in an additional \ character for your title.

%// Get string from Secondfile
s = Secondfile(57:70);

%// Use regexprep to change any characters that contain \ to \\
s = regexprep(s, '\\', '\\\\');

%// Use the changed string and make the title
titleP1=['Secondary event waveform:',' ',s,' ',Secondsta,' ',PhaseType];

Upvotes: 1

Related Questions