My code to load the image is:
ncc2 = ncc_gen(W,H,img,true)
W = ncc2.W
H = ncc2.H
plot(ncc2)
my question is how to load the image from the filenames and how to save the images?
A:
You can use fileparts to get the file part of a path
Here's an example:
%# Get the first and the last '.' characters from a path
first_dot = fileparts(img).strcmp('/.');
last_dot = fileparts(img).strcmp('/..');
%# Test it
fprintf('
First dot: %d
Last dot: %d
',first_dot,last_dot);
%# Get all the characters
curr_char = cellstr(fileparts(img));
%# Break the path
all_char = [curr_char(1:end-2) curr_char(end-1:1)];
%# Change the '.' and '..'
all_char = [all_char(first_dot:last_dot+1) '.'];
%# Here is the code that loads the image
N = length(all_char);
NCC_img = cell(N,1);
for i = 1:N
fprintf('
Loading: %s
',all_char(i));
NCC_img{i} = imread(all_char(i));
end
This will give you images named like:
somedata.ncc_img.1
somedata.ncc_img.2
etc.
As I said, this is more useful if you have many files, otherwise it's not much faster than loading each one individually.
Q:
jQuery addClass not working on dynamic elements
I have a dynamically added element:
...
The element is added on a click to a table like this:
var new_element = $("New Element ac619d1d87
Related links:
Comments