Saturday 15 September 2012

How to check a pattern in a string in matlab? -


I want to know if any string string was to do some work

  [File name] = eugetfile flowerpath = [pathname filename]   

In my program, I will browse only for pictures, all images have been named with that pattern

* _ cam1. JPG, * _cam2.jpg * _cam2.jpg, * _cam3.jpg

What do I want to do to check that the image ends with 1, then make some arguments

  If the file name cntain (cam1) was read again ('1.jpg') elseif (filename.contain (cam2)) read again ('2.jpg)   

I know there is no method called 'covered' in matlab but it shows what I want. You can use regular expression for more complex searches, but in this simple case one can Ring than enough. Allow users to select only those files, which named .jpg [file] = uigetfile '* .jpg');% file using the complete file to join pa RTS! This OS is free fullpath = fullfile (pathname, file name); If the length (filename) & gt; 8 & amp; nbsp; Amp; Strcmp (filename (end-8: end), '_cam1.jpg') accessories = reset (full path); ... otherwise the length (filename) & gt; 8 & amp; nbsp; Amp; Strcmp (filename (end-8: end), '_cam2.jpg') accessories = read (full path); ... and

This is not the most glamorous code, but it must be completed.

No comments:

Post a Comment