I'm starting to study this example but I'm not understanding the matrix operation on matlab:
Whe it does [X,T] = prprob; it will copy the predefined 26x35 matrix prprog to X and a identity matrix with less rows (26x26) to T. It works fine.
I tried the same with another matrix and got:
a =
1 4
2 5
3 6
>> [X,T] = a
Too many output arguments.
What's different from my a matrix to this prprog matrix?
This simply means that your function
prprobreturns two matrices. In other words, it has two outputs which are the two matrices you described.When you call
[X,T] = prprob, the right hand side term (prprob) will be evaluated and thus replaced by its output. Let's call[res1,res2]this output. Then your call will be equivalent to:This call holds since the two sides share the same dimension.
However, when you call
[X,T] = a, your right hand side term is evaluated as a single matrix and thus the two sides of your call do not share the same dimension. This is why you get the errorToo many output arguments.Indeed, you have one input (which is
a) and two outputs (which areXandT).Note: I saw on your profile that you develop in Java. Unlike in Java where you can only have one returned variable from a method, here in Matlab, functions can return multiple variables (in an array). This is the case here for the
prprobfunction.Oh and as the doc says in the link you provided:
It is a function not a matrix, this might also be why you were mistaken here ;)