[Scilab-users] how to respond the shrinkage of hyper-matrix
Pierre-Aimé Agnel
pierre-aime.agnel at scilab-enterprises.com
Mon Jun 22 16:43:56 CEST 2015
Hi,
I don't think there is a problem (on my 5.5.2 version) :
function hm_display(m,n,l)
a = rand(m, n, l);
for i = 1:m
for j = 1:n
for k = 1:l
mprintf("value of index [%d, %d, %d] = %f \n", i, j, k, a(i, j, k))
end
end
end
endfunction
-->hm_display(1, 2, 1)
value of index [1, 1, 1] = 0.614538
value of index [1, 2, 1] = 0.925896
-->hm_display(2, 2, 2)
value of index [1, 1, 1] = 0.099382
value of index [1, 1, 2] = 0.921327
value of index [1, 2, 1] = 0.943183
value of index [1, 2, 2] = 0.900707
value of index [2, 1, 1] = 0.428058
value of index [2, 1, 2] = 0.944902
value of index [2, 2, 1] = 0.032740
value of index [2, 2, 2] = 0.809432
Le 22/06/2015 16:22, fujimoto2005 a écrit :
> Let x=zeros(m,n,l)
> if m==1, x is generated as 2 dimension matrix, not 3 dim hyper-matrix.
> In that case the specification of elemnt like x(i,j,k) fails.
> But the value of m is unknown in advance.
> Is there any code which I can deal with such a case in general way?
>
> I don't like such as if m==1 then … else …, because the actual number of the
> dimensions of hyper matrix i'm using is more than 4 and the nest of
> if-cluase is troublesome.
>
> Best ragards
>
>
>
> --
> View this message in context: http://mailinglists.scilab.org/how-to-respond-the-shrinkage-of-hyper-matrix-tp4032488.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
--
Pierre-Aimé Agnel
R&D Projects Manager
Phone: +33.1.80.77.04.67
Mobile: +33.6.82.49.35.23
-----------------------------------------------------------
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.68
http://www.scilab-enterprises.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20150622/487e3f1c/attachment.htm>
More information about the users
mailing list