943,969 Members | Top Members by Rank

Ad:
Nov 10th, 2009
0

Help understanding some Matlab syntax (I'm porting it to python)

Expand Post »
Ok so if anyone can spare a few minutes and can tell me what each of these things are in terms of python (or plain english), that would be FANTASTIC!

(this is in a for loop where d is defined as 1-9)
D = load(['digit' num2str(d) '.ascii'],'-ascii');
save(['digit' num2str(d) '.mat'],'D','-mat');

then later in a different function:
digitdata=[]; 
targets=[]; 
load digit0; digitdata = [digitdata; D]; targets = [targets; repmat([1 0 0 0 0 0 0 0 0 0], size(D,1), 1)];  
load digit1; digitdata = [digitdata; D]; targets = [targets; repmat([0 1 0 0 0 0 0 0 0 0], size(D,1), 1)];
load digit2; digitdata = [digitdata; D]; targets = [targets; repmat([0 0 1 0 0 0 0 0 0 0], size(D,1), 1)]; 
(etc....)

digitdata = digitdata/255;
totnum=size(digitdata,1);

what exactly is going on here? what does this do:
digitdata = [digitdata; D];
?
is it appending the D object (which im guessing came from the digit1.mat it created earlier) onto digitdata?
just to be clear the .ascii file contains a file of data (1's and 0's about 1000 characters on individual lines)

also what is this doing:
digitdata = digitdata/255;
?
so is size(digitdata,1) equivelent to len(digitdata)
?

ok, now for the next batch...
input_set = zeros(xx, length_of, numsets);
(then later in another function)

[total_amount size_of_set set_num]=size(input_set);

is total_amount == xx, size_of_set == to length_of, and set_num==numsets
??

Also what does this even do:
input_set = zeros(xx, length_of, numsets);
?

So what is this doing?
input_set(:,:,b);
?
and I have absolutely no clue what is going on here:
input_set(:,:,b) = digitdata(randomorder(1+(b-1)*batchsize:b*batchsize), :);
I think I can get everything from here.

any help would be appreciated. I can figure most stuff out, and most of this stuff is semantic so I can't look it up online very easily.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
realmayo is offline Offline
8 posts
since Sep 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Computer Science Forum Timeline: Algorithm sources
Next Thread in Computer Science Forum Timeline: BNF creation





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC