Matrix analysis problem

Hi all,
I am a little stuck with a procedure I am trying to write and I hope someone can help me with this, I am sure it is so trivial I should be ashamed of myself. To make a long story short, I am creating a procedure to analyze my data, that I generate as a group of 14 spectra, each one corresponding to an stimulus of voltage. I thought that the best way to handle this is to work with the data as a matrix, and I have then a matrix of 14 rows and 127 columns that I name w458data. Now I need to subtract, from each of the rows of the matrix w458data, an standard spectrum that previously needs to be normalized to the average value between two points at the spectrum max of each row. This spectrum is also a 14x127 matrix whose z values are 0 to 1, and need to be multiplied by a value to reach the maximum of w458data rows and subsequently being substracted from the w458data matrix. Ideally I thought I could use ImageStats BEAM/RECT=(16,27,0,13) and get a wave that returns all the values, then multiply my standard (0-1) spectrum by those values and to obtain a matrix wSTD and then substract w458data - wSTD. But Igor simply CRASHES when I try to run ImageStats /BEAM. Both in mac and PC the program stops working out of a sudden.
I guess there is something wrong with my idea on how to do this. Please, could you give me ideas? I have a bunch of data to analyze and I would really apreciate any help.
Thanks,
Teresa
tgiraldez wrote:
But Igor simply CRASHES when I try to run ImageStats /BEAM. Both in mac and PC the program stops working out of a sudden.


You are better off reporting crashes of Igor to WaveMetrics, since they are the only people that can easily diagnose and fix crashes. If you're getting Igor to crash there is in all likelihood a problem that you can not fix yourself.

If you can reliably get a crash, send step by step instructions of how to reproduce the crash, as well as a sample experiment they can use to reproduce the problem, to support@wavemetrics.com. Make sure to include the version of Igor and the operating system you are using.

Before you send a bug report, I would also recommend that you check the Igor Updates page at http://www.wavemetrics.com/support/versions.htm and make sure that you've got the latest update for the major version of Igor you are using. It's possible that the bug you've found has already been fixed.

If, after fixing the crash, you still have questions about what you're trying to do, feel free to post them here again. One note--it's often helpful if you can include some (simplified) code as an example of what you are doing.

Good luck
Thanks, Adam. I just got great help by A.G. from wavemetrics. First of all, I need to know that ImageStats cannot be used with non-3D waves. My mistake.
Secondly, he had a great solution (thanks again AG!) for my question, that I post here in case it can help other Igor users.

Function processData(w458data,wstd)
Wave w458data,wstd

Variable numCols=DimSize(w458data,1)
Variable numRows=DimSize(w458data,0)
Variable i,j

Variable factor
String name
Variable avg

Duplicate/O wstd,scalingMatrix
for(i=0;i<numCols;i+=1)
MatrixOP/O theCol=col(w458data,i)
avg=Sum(thecol,16,27)/12
MatrixOP/O theCol=avg*col(wstd,i)
scalingMatrix[][i]=theCol[p]
endfor

MatrixOP/O w458Subs=w458data-scalingMatrix
KillWaves /Z scalingMatrix
End


Hope it ever helps someone as it did help me. Cheers,
Teresa


Just one minor correction:

ImageStats works with both 2D and 3D waves. On the other hand, "Beams" apply only to 3D waves and as such the combination /BEAM with a 2D input was unfriendly to IGOR. This has been fixed for the next beta release.

A.G.
WaveMetrics, Inc.