I have a column matrix, called "a", with x rows. I'm trying to create a matrix filled with 1's that has the same number x rows.
When I say newmat = (N Rows(a), 2), I get the error "Expected integer for number of rows" when trying to create the matrix.
Type(3), and any other integer argument, will return "Integer" but Type(N Rows(a)) returns "Number". I tried setting the x rows to a variable name and trying that, but I get the same error. Is there another way to do this? I haven't found a way to convert a Number type to an Integer type on the boards or in the documentation.
Here are a couple of ways to create the matrix you are looking for
clear symbols(); a=[1 ,2 ,3]; b=j(n rows(a),1,1) // or b=a; b[1::n rows(a)]=1;
@uday_guntupalli is correct that J() is exactly the right function for this. To get at the reason JMP is yelling at you is that certain JMP functions don't like to take variable names are arguments. If needed, you can solve these kinds of problems with an eval-parse-eval insert sequence like so:
eval(parse(eval insert("newmat = (^N Rows(a)^, 2)")));
Please use Uday's solution, but this tip may help you later when you encounter a similar situation.