|
-
December 11th, 2007, 05:07 AM
#6
Re: Read & write multiple images by single execution(Matlab)?
 Originally Posted by tommy_chai
T
(end-3:end)
Do you mean "D(i).name" is the 4 elements?
What does "end-3" means?
Let's say the filename is "a.pgm". Do you mean the ".pgm" is the 4 elements? So the function compares the extension ".pgm" only? Does it compare the filename, "a" in this example?
First of all, D(i).name is the whole file name. We want to compare the extension of each file name (i.e. of each D(i).name), because in the given folder you may have files of other types which you cannot read using imread. So in order to do this, we take the last 4 elements (i.e. the extension of the file). In general, Matlab has a very simple way of taking a subvector (or substring). Suppose you have a vector called str. By typing:
You take the elements 4 to 7 of the str array. In the same way, by typing:
Code:
...D(i).name(end-3:end)...
you take the elements N-3,N-2,N-1 and N of the string D(i).name, where N is the length of the array, which (only when used as above is given by the "end" keyword).
In any case, you should also read a simple introductory Matlab tutorial (google for it), in order to get the basic of Matlab. For example:
http://www.mathworks.com/academia/st...ter/tutorials/
Regards,
Theodore
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|