| Author |
Topic  |
|
|
vinod
Average Member
  
USA
68 Posts |
Posted - Jul 19 2007 : 11:53:01 AM
|
| How do I customize my Matlab path on BIAC computers? Usually, I create a startup.m file to the startup work directory but on BIAC machines, I dont have permission to create one. I tried to change the pathdef file to have these permanently but don't have permission to do that either. I don't want to be adding things like user_scripts folder on Gall each time I write a script. |
|
|
josh.bizzell
BIAC Staff
   
USA
118 Posts |
Posted - Jul 19 2007 : 11:55:07 AM
|
Put your startup.m file in the top level of your user directory (the U: drive), and it should work.
|
 |
|
|
petty
BIAC Staff
    
USA
453 Posts |
Posted - Jul 19 2007 : 11:55:55 AM
|
put a startup.m file in your user drive (U:\), when you start matlab it should find that file.
just add multiple addpath comments in the file. |
Edited by - petty on Jul 19 2007 11:57:50 AM |
 |
|
|
vinod
Average Member
  
USA
68 Posts |
Posted - Jul 19 2007 : 12:05:50 PM
|
| Thanks guys, that worked. And Josh beat petty by 48 secs :), but petty had more things to type :) |
 |
|
|
vinod
Average Member
  
USA
68 Posts |
Posted - Jul 20 2007 : 11:03:57 AM
|
Here is another matlab question:
I have a data matrix which is a 3-d matrix of size 91x109x91 (FSL standard) I have a bunch of ROI coordinates in a variable coords, dimension = 115x3 corresponding to 115 voxels in my ROI
Without having to loop through each coordinate and extracting the corresponding value from the data matrix, is there an easier way to get the data values for each of the 115 voxels.
I tried ROIdata = data(coords) and ROIdata = data(coords(:,1),coords(:,2),coords(:,3)) but it doesn't do it. |
 |
|
|
syam.gadde
BIAC Staff
    
USA
421 Posts |
Posted - Jul 20 2007 : 12:36:17 PM
|
A loop is the only way I can think of accessing the multi-dimensional array. Your listed methods won't work. An alternative is to think of the data matrix as a one-dimensional array, and convert your coordinates to indices into that one-dimensional array. If you index a multi-dimensional matrix with a scalar i like this:
data(i)
Then i is treated as an index into the "flattened" data. You can also send a list:
data([i1, i2, i3, i4, i5, i6, ...])
which will return a list of the values at each of those flattened indices. Note that this is different than:
data(i1, i2, i3, i4, i5, i6)
which would be indexing into a 6-D array with a 6-D coordinate. |
 |
|
|
josh.bizzell
BIAC Staff
   
USA
118 Posts |
Posted - Jul 20 2007 : 3:03:07 PM
|
To further what Syam suggested, you can use the function "sub2ind" to create the scalar index from the coordinates.
>> idx = sub2ind([91,109,91],coordx,coordy,coordz);
However, I believe you'll still have to loop through the coordinates because this function doesn't take array inputs for the coordinates.
-Josh |
 |
|
|
vinod
Average Member
  
USA
68 Posts |
Posted - Jul 20 2007 : 3:12:46 PM
|
| Thanks guys. My instincts were the same too but just wanted to be sure there was no other 'elegant' way to do this. |
 |
|
|
charles.michelich
BIAC Alum
   
USA
183 Posts |
Posted - Jul 29 2007 : 12:03:02 AM
|
sub2ind does not take an array of coordinates, but it will take vectors of coordinates as inputs. Therefore, an "elegant" way to accomplish your goal is:
voxelData = data(sub2ind(size(data), coord(:,1), coord(:,2), coord(:,3))); |
 |
|
| |
Topic  |
|