I guess it is tara that caused you the trouble.
A while ago, Martin suggested to me:
> The last line in tara.ijs:readexcelstring reads:
>
> m=. cell (<"1 ix-"1 off)}m=. rcs$a:
>
> If you use rcs$<'' instead as boiler plate,
by the same token, if you expect all values will be numeric and you are going to
use 0 as fill value, then modify the last line in tara.ijs:readexcel:
m=. cell (<"1 ix-"1 off)}m=. rcs$<0
I think this will eliminate the need for reshape.
Leigh J. Halliwell wrote:
> Dear Dan and R.E.Boss:
>
> Thank you for your solutions. I now understand a little better the
> all-important "Rank" concept. I agree, one should make the operation return
> the right rank, rather than afterward reduce the rank.
>
> My problem came when unboxing a matrix of scalars, in which there were some
> empty boxes for missing values (like empty cells from a spreadsheeet range).
> I now see that a: (ace) has rank 1. It is not really an empty box, but a
> box containing a zero-element vector (I guess that you can't have a really
> empty box in J). Hence, if there is an ace in the matrix, the operation >"0
> will have the shape (($Matrix), 1). And the cells will unbox as zeros (more
> accurately, as 1$0). I solved the problem with ({. & >)"0. This one-step
> solution seems more efficient that the two steps >"0 and {."0.
>
> I also just realized that an atom (scalar) can be produced from (i.0) $
> scalar, which is just as it ought to be according to J rank theory.
> Sometimes primitives seem quirky, but here everything makes sense.
>
> Sincerely,
>
> Leigh
>
> -----Original Message-----
> So, now that I've given you the bandaid, I'd like to teach you preventative
> medicine. You should (nearly) always be able to predict the ranks of the
> results produced by your code.
>
> If you cannot, and you find you "need to remove a trailing axis", it's
> better to investigate why that's so, and modify the code that produces the
> trailing axis, rather than removing it ex post facto.
>
> If you post a small working example of the code that's causing you trouble,
> we'll probably be able to explain what's wrong, and help you fix it.
>
> -Dan
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
>
--
regards,
bill
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm