Saturday, August 4, 2012

histc, histogram count

http://www.mathworks.com/help/techdoc/ref/histc.html

n = histc(x,edges) counts the number of values in vector x that fall between the elements in the edges vector (which must contain monotonically nondecreasing values). n is a length(edges) vector containing these counts

Very useful. Plot histogram points instead of bar graph. Need to calculate bin centers and use as x values. Divide the result of histc by the length(x) to get the y values. Plot.

Friday, July 6, 2012

illustrator shortcuts

After decades of using Illustrator in a dumb way (okay maybe only 1.4 decades), I learned a few key points.

  • If tracing an original, make it a layer, name it, and lock it.
  • Make a new layer, name it, and draw on it. 
  • Use shortcut Z, zoom
  • Use shortcut V, arrow
  • Use shortcut [space], hand
  • Use the different "corner" options (near the stroke box) so they're not pointy or pointy.
I think that's all.

Wednesday, June 20, 2012

vectorizing an image

Vector Magic

http://vectormagic.com/home

Takes an image that may become pixelated upon enlargement and vectorizes it into .pdf or other format. I used it for a logo that we wanted to blow up for a banner. Pretty neat. Two free conversions.

Tuesday, June 5, 2012

artboard size in Illustrator

Adobe Illustrator is yet another program that I have never fully grasped. 

But here's how to change the size of the "Artboard" (corresponding to the "page", and holding the artwork that is printed or saved as PDF).

File > Document Setup > Edit Artboards

You should get a drag-able box. 

Useful if you want to scale a 6-inch image by 1000% for a banner. 

Wednesday, May 2, 2012

tables are out, DL, DT, DD is in

Some info on using definition lists to make table-like displays that are more maintainable:

http://www.onextrapixel.com/2009/05/13/how-to-use-dl-dt-and-dd-html-tags-to-list-data-vs-table-list-data/

http://www.maxdesign.com.au/articles/definition/

You can add the style information to the .css or to the top of the html page to test e.g.

style type="text/css"
dl dd { padding-bottom:0.5em; }
dl dt {float:left;} dt {text-align:left; width:8em;}
dl dd {margin-left:9em;}
dl { padding-bottom:0.5em; }

(add style tags before and after)


Thursday, January 5, 2012

finding and indexing in matlab

This is something as ridiculous as in 2001 when I didn't know how to use .ppt so I just made .html presentations.

Well I don't know procedural SQL so I'm using matlab to find and index things.

The problem:
I had a big table in a database and you want to fill in a certain column with an index that depends on other relationships in that table.  (Basically, filling in parent-child relationships but each row has several identifiers: name, unique ID, other unique ID.)

The first loop demonstrates how to use "find" with strings: find the index in the array "name" where the cell value (string) equals input_name(i).

for i = 1:length(input_name)
    igsn_output(i) = igsn(find(ismember(name, input_name(i))==1))
end
igsn_output = transpose(igsn_output);

This second one is just weird, it was giving string/cell/ etc. errors but this worked (input_parent was a number but in a cell array).

for i = 1:length(input_name)
    parent_id_output{i} = cell2mat(sample_id(find(ismember(igsn, input_parent(i))==1)))
end
parent_id_output = transpose(parent_id_output);

I pasted it all into excel and then used "concatenate" to form the SQL statements.

This all could've been done in the SQL environment if I knew procedural postgreSQL.

They shouldn't let scientists code.