Highlighting ALL occurrences of a given string using Find

19 views (last 30 days)
I'd like to search for a word that appears very often in my script — often enough that to go from occurrence to occurrence using F3 is not practical.
Instead, I would like to have all the occurrences of that word highlighted in my script, so I can quickly scan the script and find the occurrence i need.
I don't just mean highlighting of variables but of whatever search string is entered in the find box
Is there a way to do this in Matlab? In Chrome for instance it looks like this:
I'm almost certain this cannot be attained in the current version of Matlab, for which reason perhaps I would suggest this go down as a piece of feedback for the next version.
  2 Comments
z8080
z8080 on 16 May 2022
It is very disappointing to see these forums reduced to such low traffic, and so little usability. If it's come so that any question takes weeks to get an answer, presumably because all the kind souls who used to help on here, have now migrated from Matlab to Python/JS/R, then perhaps that's what disappointed Matlab users are best advised to do as well.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 16 May 2022
If you simply click your cursor in a variable name, it will highlight all instances of that variable in the current scope. Sorry but it works only for variable names, not arbitrary text strings.
If a question goes unanswered for more than a day or so, it could be due to one of these reasons
  1. The question is so esoteric that no one who's looked over the list of questions felt like they were knowledgeable to answer it. If you ask a very specialized question that only one person in 10 thousand would know how to solve, then that one person may not have visited the Answers forum (yet).
  2. There is too much information missing so that no concise answer could be given. Like it depends on some missing info and could be one of 10 different kinds of answers depending on what was missing. Or it's just too vague like "tell me how to solve differential equations."
  3. There is too much information. Posting your whole program in the message box when the whole program is a thousand lines or more will probably lead to people ignoring it, especially if it's an alphabet soup mess of a program with short, cryptic variable names and no comments.
  4. Code is posted as a screenshot rather than as text. No one is going to type all that stuff it. You have to make it easy for people to help you or else they'll just move on to the next question.
  5. It would take too long to answer. If it can be answered in 5 minutes or less it probably will be. If it's going to take hours or longer, probably not, or perhaps it will just get a link to somewhere that may help, like to a paper or VisionBibliography or PubMed or somewhere. For example "I need biometric code to do facial recognition and speaker identification for authentication/access purposes". No one is going to spend months to write that for them, and even if they did have it probably would not bundle it up and hand it over, and then spend hours explaining how to run it.

More Answers (0)

Categories

Find more on Historical Contests in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!