Archive for January, 2008

Creating custom block sets (toolboxes) in Matlab Simulink

January 29, 2008 Leave a comment

Here’s a quick tutorial on how to create and integrate custom toolboxes into Matlab Simulink. This can be useful when certain blocks, such as custom PID controllers, are used repeatedly. For this example, I made a toolbox that is as simple as it gets. It’s a flowchart toolbox for layered idea organization. Simulink has an interesting advantage over MS Visio and other flowchart programs in that blocks can have layers of complexity realized by Simulink’s subsystem layout.

Here’s the Mathworks tutorial on block libraries. I follow it to a large extent, but there are necessary steps for integrating custom block sets that are not covered in the tutorial.

Step 1: Create toolbox as a library

The first step is to create a single library including all the blocks for your new toolbox. This is the File > New > Library menu item in the Simulink Library Browser.

After creating the library, make sure the library is unlocked (Edit > Unlock) and open the Model Explorer (View > Model Explorer). Rename each block to have the title you’d like to see in the library browser.

Step 2: Add the library to the library browser

A short but incomplete description of this process is found in the Mathworks page already mentioned. I recommend starting with that, but when you’ve completed the listed steps be sure to keep the toolbox path in the Matlab path perminantly. I did this by adding the following lines to the end of my slblocks.m file.

% Add the toolbox to the path
% End of slblocks

Run the .m file for the path change to take effect.

My Flowchart Blockset

My flowchart blockset is found in the following .zip file. As mentioned above, install it this way:

1. Copy the ‘flowchart’ folder to %matlabpath%/toolbox/
2. Run ‘slblocks.m’

Categories: Innovation, PC Software

USB game controller profiles for Project64

January 23, 2008 7 comments

Here’s my profile for my Gamez USB gamepad I use with Project64. It may save ya time! If you use another button layout, you can easily change my image in PowerPoint to describe it. I may post multiple profiles here at a later time if they are useful.

EDIT 2017-11-03:┬áThis config file is not compatible with current versions of Project64. I made this profile for Project64 1.6 ten years ago. Project64 version 1.6 used a different Input (controller) plugin at the time (Jabo’s DirectInput7 1.6), which used *.jsf controller files. Current Project64 version 2.3 uses N-Range for PJ64:, which loads *.cpf controller profiles.

Categories: PC Software

USB Gamepad Priority in Project64 Nintendo 64 emulator for PC

January 8, 2008 3 comments

I have been using Project64 to play Nintendo 64 (1996) games on my laptop. This works amazingly well, and it is great fun to connect the computer to a TV or projector screen using an S-Video cable and a 3.5mm stereo to right/left mono plugs.

Recently I found some cheap gamepads online for $3 each and tested them today. It’s difficult for people to convince me that I should spend money on these things, because these controllers work exceptionally well.

I did encounter a problem, though, when I tried to keep track of which gamepad corresponded to which player in a N64 game. I labeled the gamepads with numbers 1-4, but each time I plugged them in they seemed to be assigned random player #’s again. I was wrong about this, but I’ll discuss my process for finding a good solution anyway.

I originally thought the player order was based on the order in which gamepads were connected. This was proven to be incorrect when I disconnected a controller and when I reconnected it a controller which had not been moved had changed from one player to another. My next thought based on research was to try the JoyID tool described next, but this was not the solution either.

Wingman Team JoyID tool

From searching forum posts, I found references to this JoyID
swapper program for changing the ID order of gamepads. This was not useful for my purpose, but it does change the JoyID’s, though not used by Project64. It turns out that Project64, and probably many other games, use Hardware ID’s rather than JoyID’s to identify the priority of USB gamepads.
Besides not being the solution to my problem, I also find it inconvenient that the swapping program has no way to associate which gamepad currently corresponds to which number. It would be useful if a gamepad was highlighted when a button was pressed, or something like that.

Download or research Wingman Team’s JoyID swapper program

Hardware ID’s
Microsoft descriptoin of Windows Hardware ID’s for Human Interface Devices (HID’s) is found here. This turns out to be the solution of the problem. As described in the link above, the hardware ID is based on the physical USB jack where the gamepad is plugged in. To make my system easily usable, I labelled the USB hub where I connect the gamepads to keep the same order of players. This can be seen in my first image on the top left. To summarize, the physical location, not the connecting order in time, defines the order of players associated with gamepads.
Categories: Electronics, PC Software

Rename files by date

January 7, 2008 Leave a comment

Here’s a nifty program for renaming files by date so they will be sorted in that order. The program is designed for sorting pictures from a digital camera that have capture dates inside the files that are not changed by copying the file to new locations.

The program can also rename files based on their windows file dates. This is useful in my case to rename digital copies of class notes posted on Ohio State’s secure class site I had a professor who had variable naming conventions, with one day being titled “lec25” and the next “day25.” These file names are difficult to keep organized without a program like this one.
The program can also be useful for organizing pictures with cryptic names by the date of the file on the computer.
So, here it is. The program is called STAMP. You can download it here:

EDIT: This may be a more universal program to use, recommended by Lifehacker:

Here’s how I used it:
After installing the program from the link above, the screen on the right should be the first one you see when you open the program.
Source Folder is the location of the files you would like to rename.
Output Folder is the location where you would like the renamed files to be copied. I recommend a new folder.
Move or Copy: I recommend selecting Copy from the drop down box in case there are unexpected naming results. This makes it easy to try again, but it makes a second copy of all the files you are renaming. If you would prefer not to do this for a large number of files, I suggest using the Copy option for a small selection to make sure the results are what you expect before renaming all the files.
Format: This option changes how the output filenames look. This page tells more about the premade formats, and others can be custom-described:

Here is the second tab of the program’s options. This is where I made changes because I was not renaming pictures with time data that the program expects.
I selected Timestamp all files and Use File System dates only so the file dates would be used rather than looking for information in the files.
I also chose to Timestamp all files so my files would be renamed even though they did not have time information inside the files.

Here is the last page of options. No changes are needed here.
Categories: PC Software