[Scilab-users] Hypermatrix manipulation
Rafael Guerra
jrafaelbguerra at hotmail.com
Tue Nov 17 00:04:15 CET 2015
Hello,
Here below a more inefficient solution but that might fit your needs:
// Hypermatrix definition M(x,y,z,k)
x=[1 1.5 2]; y=[0 1 %e %pi]; z=[2 3].^0.5; k=1:5;
nx=length(x); ny=length(y); nz=length(z); nk=length(k);
M=rand(nx,ny,nz,nk);
// Write coordinates and M to disk:
fid = mopen("hyper_out.txt",'w');
for i=1:nx; for j=1:ny; for m=1:nz; for n=1:nk
mfprintf(fid,"%15.5f%15.5f%15.5f%15.5f%15.5f\n",x(i),y(j),z(m),k(n),M(i,j,m,n));
end; end; end; end
mclose(fid)
Regards,
Rafael
-----Original Message-----
From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Serge Steer
Sent: Monday, November 16, 2015 8:43 PM
To: users at lists.scilab.org
Subject: Re: [Scilab-users] Hypermatrix manipulation
Le 16/11/2015 18:39, petarf a écrit :
> Hi,
>
> Could anyone help with storing data from a hypermatrix( M(x,y,z,k) ) to a
> file. I would like to import this data to another software ( Gambit or
> Pointwise).
>
> Hypermatrix M consists only of numbers.
I do not know Gambit nor Pointwiseinput format, but you can transform
your hypermatrix to a 1D array using v=M(:) then write the vector and
the dimensions in an ascii file using the mfprintf function....
Nb V=[M(1,1,1,1);M(2,1,1,1);...M(1,2,1,1);M(2,2,1,1);... M(1,1,2,1);....]
> Thank you for your help.
> Best regards, Petar
>
>
>
> --
> View this message in context:
<http://mailinglists.scilab.org/Hypermatrix-manipulation-tp4033098.html>
http://mailinglists.scilab.org/Hypermatrix-manipulation-tp4033098.html
> Sent from the Scilab users - Mailing Lists Archives mailing list archive at
Nabble.com.
> _______________________________________________
> users mailing list
> <mailto:users at lists.scilab.org> users at lists.scilab.org
> <http://lists.scilab.org/mailman/listinfo/users>
http://lists.scilab.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
<mailto:users at lists.scilab.org> users at lists.scilab.org
<http://lists.scilab.org/mailman/listinfo/users>
http://lists.scilab.org/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20151116/1e64f596/attachment.htm>
More information about the users
mailing list