SlimJim Posted October 17, 2005 Share Posted October 17, 2005 This is my first effort at Custom Functions so be kind. I am working with the example file Matrix Math from http://www.spf-15.com/fmExamples/ and some of the functions below are from that file. I have defined a custom function AddRow which simply adds a new row into a matrix at a given position (the position is the row number of the vector in the new matrix. AddRow is defined as AddRow(matrix,row,vector) = Case( Cols(matrix) ≠ Cols(vector) or Int(row) ≠ row or row > Rows(matrix) + 1 or row ≤ 0;matrix; LeftValues(matrix;row - 1) & vector & If(row ≠ Rows(matrix) + 1; "¶";"") & RightValues(matrix;Rows(matrix) - row + 1 )) Here vector is a list in the form v = "a1; a2; ... ; an;" Cols(v) = n and matrix is a value list of vectors A = v1 & "¶" & v2 & "¶" &... &vm) all with the same number of columns and Rows(A) = m. THis function works fine.I need a similar function AddCol to add a column to a matrix in a given position and it seemed to me that the obvious thing to do was to use Transpose and AddRow. So I am trying to add a column whose elements are from a given (row) vector AddCol(matrix;col;vector) = Transpose(AddRow(Transpose(matrix);col;vector)) OK here is the problem. AddCol does not work FMP gives me the ? However, if I write down the formula for AddCol above and Evaluate it it does work. Am I missing something about custom functions calling custom functions? Any help appreciated. Link to comment Share on other sites More sharing options...
SlimJim Posted October 17, 2005 Author Share Posted October 17, 2005 Ignore this post - I don't know what I was doing when I tested it but it works fine now. Link to comment Share on other sites More sharing options...
Recommended Posts
This topic is 6787 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now