Re: [Scilab-users] add value to each element of an array, also to an empty one

2017-03-24 Thread Rafael Guerra
An ugly alternative without find and without the if as requested:

A =  [ -1 2 7 ];

I = (A>10).*(cumsum(ones(A))+1);
I(I==0) = []
I  =
 []

I = (A>0).*(cumsum(ones(A))+1);
I(I==0) = []
I  =
3.4. 

Rgds,
Rafael



--
View this message in context: 
http://mailinglists.scilab.org/add-value-to-each-element-of-an-array-also-to-an-empty-one-tp4035989p4035996.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] 3D interpolation

2017-03-24 Thread paul . carrico
thanks all for the answers; I didn't know about ndgrid and I'm currently
having a look on it (seems to be quite interesting) 

Samuel: from your example and the help doc, I need to understand how to
proceed to perform linear interpolations (temperatures and abscissa's in
my example) 

Paul 

Le 2017-03-24 21:40, Samuel Gougeon a écrit : 

> Le 24/03/2017 à 18:40, paul.carr...@free.fr a écrit :
> 
>> Hi all,
>> 
>> I don't know if my question is relavante (or not), but I'm wondering
>> what is the best way to perform a 3D interpolation, from for the
>> matrix definition to the interpolation procedure.
>> 
>> Let me using a basic example: I've some curves y = f(x,T) defining a
>> material behaviour at different temperatures i.e. 1 curve (x,y) per
>> temperature:
>> - y = f(x,20)
>> - y = f(x,100)
>> - y = f(x,200)
>> 
>> etc.
>> 
>> What is the best way to define a single matrix? [x y T] ?
> 
> It depends on whether f() is vectorized or not. It could be something
> like
> t = [20 100 200];
> [X, T] = ndgrid(x, t);
> Y = f(X,T);
> // or
> Y = feval(x, t);
> 
> Then:
> M = [X(:) Y(:) T(:)];
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] 3D interpolation

2017-03-24 Thread Samuel Gougeon

Le 24/03/2017 à 18:40, paul.carr...@free.fr a écrit :

Hi all,

I don't know if my question is relavante (or not), but I'm wondering 
what is the best way to perform a 3D interpolation, from for the 
matrix definition to the interpolation procedure.


Let me using a basic example: I've some curves y = f(x,T) defining a 
material behaviour at different temperatures i.e. 1 curve (x,y) per 
temperature:

- y = f(x,20)
- y = f(x,100)
- y = f(x,200)

etc.

What is the best way to define a single matrix? [x y T] ?


It depends on whether f() is vectorized or not. It could be something like
t = [20 100 200];
[X, T] = ndgrid(x, t);
Y = f(X,T);
// or
Y = feval(x, t);

Then:
M = [X(:) Y(:) T(:)];


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] add value to each element of an array, also to an empty one

2017-03-24 Thread Erhy
Samuel GOUGEON wrote
> Not in Scilab 6, for the time being. I assumed that you were using Scilab
> 6.

so I will jump to version 6
Thank you!




--
View this message in context: 
http://mailinglists.scilab.org/add-value-to-each-element-of-an-array-also-to-an-empty-one-tp4035989p4035993.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] add value to each element of an array, also to an empty one

2017-03-24 Thread Samuel Gougeon

Le 24/03/2017 à 21:08, Erhy a écrit :

Samuel GOUGEON wrote

  1. length(I)==0 means I==[] and then I+1 == []+1 ==[]  as if nothing

But in my examples
I = [];
Iplus = I + 1;
then Iplus is 1

Not in Scilab 6, for the time being. I assumed that you were using Scilab 6.
In Scilab 5: i know nothing simpler than testing if I~=[]


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] add value to each element of an array, also to an empty one

2017-03-24 Thread Erhy
Samuel GOUGEON wrote
>  1. length(I)==0 means I==[] and then I+1 == []+1 ==[]  as if nothing

But in my examples
I = [];
Iplus = I + 1;
then Iplus is 1




--
View this message in context: 
http://mailinglists.scilab.org/add-value-to-each-element-of-an-array-also-to-an-empty-one-tp4035989p4035991.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] add value to each element of an array, also to an empty one

2017-03-24 Thread Samuel Gougeon

Hello Erhy,

Le 24/03/2017 à 20:36, Erhy a écrit :

Hello!
Again a basic question.
e.g.
A =  [ 1 2 3 ];
I = find( A > 10);
if length(I) > 0 then
I = I + 1;
end

Is there a alternative
*without the if ?*


Yes, just:
I = I + 1
The if is useless:

1. length(I)==0 means I==[] and then I+1 == []+1 ==[]  as if nothing
   was done
2. otherwise, just add 1


I miss the .+ operator.


So do i, sometimes.

Samuel

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] add value to each element of an array, also to an empty one

2017-03-24 Thread Erhy
Hello!
Again a basic question.
e.g.
A =  [ 1 2 3 ];
I = find( A > 10);
if length(I) > 0 then
I = I + 1;
end

Is there a alternative
*without the if ?*

I miss the .+ operator.

Thank you  



--
View this message in context: 
http://mailinglists.scilab.org/add-value-to-each-element-of-an-array-also-to-an-empty-one-tp4035989.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] 3D interpolation

2017-03-24 Thread Tim Wescott
That doesn't show up in the help for 5.5.2.  Is it a 6.x thing, or is
there a toolbox?  Looks interesting, at any rate.

On Fri, 2017-03-24 at 18:45 +0100, CRETE Denis wrote:
> Hello !
> Did you try cshep2d + eval_cshep2d ?
> HTH
> Denis
>  
> [@@ THALES GROUP INTERNAL @@]
>  
> Unité Mixte de Physique CNRS / THALES
> 1 Avenue Augustin Fresnel
> 91767 Palaiseau CEDEx - France
> Tel : +33 (0)1 69 41 58 52 Fax : +33 (0)1 69 41 58 78
> e-mail :
>  denis.cr...@thalesgroup.com 
> http://www.trt.thalesgroup.com/ump-cnrs-thales
> http://www.research.thalesgroup.com
>  
> De : users [mailto:users-boun...@lists.scilab.org] De la part de paul
> .carr...@free.fr
> Envoyé : vendredi 24 mars 2017 18:41
> À : User Scilab
> Objet : [Scilab-users] 3D interpolation
>  
> Hi all,
> 
> I don't know if my question is relavante (or not), but I'm wondering
> what is the best way to perform a 3D interpolation, from for the
> matrix definition to the interpolation procedure.
> 
> Let me using a basic example: I've some curves y = f(x,T) defining a
> material behaviour at different temperatures i.e. 1 curve (x,y) per
> temperature:
> - y = f(x,20)
> - y = f(x,100)
> - y = f(x,200)
> 
> etc.
> 
> What is the best way to define a single matrix? [x y T] ?
> 
> 
> Next step is to be able to perform a 3D interpolation whatever is the
> temperature (for a given x) ... any advice? (of course I'm looking to
> interp3D flag.
> 
> Thanks for any feedback
> 
> Paul
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
-- 

Tim Wescott
www.wescottdesign.com
Control & Communications systems, circuit & software design.
Phone: 503.631.7815
Cell:  503.349.8432



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] 3D interpolation

2017-03-24 Thread Tim Wescott
I'm not an expert.  But:

I did a quick spin through the help files and came up with splin2d and
interp2d.  It looks like what you want -- get the splines in x and T
using splin2d, and find the y values for a given x and T using
interp2d.

I don't know if this is the very best way to do this mathematically --
I know that this sort of 2D interpolated look-up is used extensively in
engine management units in cars (they're called "maps" in that lingo),
so there's probably a lot of research on accuracy vs. efficiency
tradeoffs.

On Fri, 2017-03-24 at 18:40 +0100, paul.carr...@free.fr wrote:
> Hi all,
> 
> I don't know if my question is relavante (or not), but I'm wondering
> what is the best way to perform a 3D interpolation, from for the
> matrix definition to the interpolation procedure.
> 
> Let me using a basic example: I've some curves y = f(x,T) defining a
> material behaviour at different temperatures i.e. 1 curve (x,y) per
> temperature:
> - y = f(x,20)
> - y = f(x,100)
> - y = f(x,200)
> 
> etc.
> 
> What is the best way to define a single matrix? [x y T] ?
> 
> 
> Next step is to be able to perform a 3D interpolation whatever is the
> temperature (for a given x) ... any advice? (of course I'm looking to
> interp3D flag.
> 
> Thanks for any feedback
> 
> Paul
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
-- 

Tim Wescott
www.wescottdesign.com
Control & Communications systems, circuit & software design.
Phone: 503.631.7815
Cell:  503.349.8432



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] 3D interpolation

2017-03-24 Thread CRETE Denis
Hello !
Did you try cshep2d + eval_cshep2d ?
HTH
Denis

[@@ THALES GROUP INTERNAL @@]

Unité Mixte de Physique CNRS / THALES
1 Avenue Augustin Fresnel
91767 Palaiseau CEDEx - France
Tel : +33 (0)1 69 41 58 52 Fax : +33 (0)1 69 41 58 78
e-mail :
 denis.cr...@thalesgroup.com 

http://www.trt.thalesgroup.com/ump-cnrs-thales
http://www.research.thalesgroup.com

De : users [mailto:users-boun...@lists.scilab.org] De la part de 
paul.carr...@free.fr
Envoyé : vendredi 24 mars 2017 18:41
À : User Scilab
Objet : [Scilab-users] 3D interpolation

Hi all,

I don't know if my question is relavante (or not), but I'm wondering what is 
the best way to perform a 3D interpolation, from for the matrix definition to 
the interpolation procedure.

Let me using a basic example: I've some curves y = f(x,T) defining a material 
behaviour at different temperatures i.e. 1 curve (x,y) per temperature:
- y = f(x,20)
- y = f(x,100)
- y = f(x,200)

etc.

What is the best way to define a single matrix? [x y T] ?


Next step is to be able to perform a 3D interpolation whatever is the 
temperature (for a given x) ... any advice? (of course I'm looking to interp3D 
flag.

Thanks for any feedback

Paul
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] 3D interpolation

2017-03-24 Thread paul . carrico
Hi all,

I don't know if my question is relavante (or not), but I'm wondering
what is the best way to perform a 3D interpolation, from for the matrix
definition to the interpolation procedure.

Let me using a basic example: I've some curves y = f(x,T) defining a
material behaviour at different temperatures i.e. 1 curve (x,y) per
temperature:
- y = f(x,20)
- y = f(x,100)
- y = f(x,200)

etc.

What is the best way to define a single matrix? [x y T] ?

Next step is to be able to perform a 3D interpolation whatever is the
temperature (for a given x) ... any advice? (of course I'm looking to
INTERP3D flag.

Thanks for any feedback

Paul___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Reading numerical and string vectors from txt-file

2017-03-24 Thread Jens Simon Strom
mgetl(filename)  is a good alternative. I have used it in a function 
because retrieving numbers comes up frequently for me.


function  cv=!cv(fp,colspan,varargin)//Extracts a numeric Colum Vector from 
ASCII file
  //Data separator in file:  spaces only, number may differ from line to line 
to cope with ragged colums
  //fp: full path of ASCII file, type string
  //colspan: Increasing row vector of colum indices, position range of the 
numbers, type constant
  // The data colum may be ragged but no other characters may protrude 
into the colum span.
  //varargin: optional string vector, line numbers to read
  //cv: colum vector of read numbers, type constant
  //CAVEAT: If the file uses separating tabs they should be replaced by blanks. 
colspan should be enclosed
  //in at least one leading and one trailing blank in all lines (check 
in editor).
  //Examples:
  //cv=!cv('file.txt',[12:15]) //reads colums 12 to 15 of all lines
  //cv=!cv('file.txt',[1:6],'[10:$-3]') //reads colums 1 to 6 of 10th to third 
last line, good for masking headers and footers
  //cv=!cv('file.txt',[1:6],'[1 11 101]') //reads distant lines
  fdescr=mopen(fp,'r');//file descriptor
  txtlines  =  mgetl(fdescr,-1);//string colum vector with all lines
  mclose(fdescr);
  [lhs,rhs]=argn(0)
  if  rhs==3  then
  execstr('txtlines=txtlines('+varargin(1)+')')//reduction to the requested 
lines
  end
  cv  =   strtod(part(txtlines,colspan))//string to double
endfunction

Jens
---

Am 23.03.2017 09:51, schrieb Jan Åge Langeland:




On 23.03.2017 00:25, Jens Simon Strom wrote:
The test data I posted had been preprocessed manually by equalizing 
the spaces between the colums to a single one. The original output of 
the MICA astro software aligns the colums tidily so that the number 
of spaces varies along a line and from line to line if the values 
vary between 1 and 3 digits. One can fix that with regex. It would be 
workflow supporting if the separator input ofcsvRead would interpret 
several blanks as equivalent to one or if automation could be 
acchieved elsewise.

Jens
--


If you have fixed column widths, maybe something like this is better:

Ma=mgetl(filename)
skiplines=7
clear Md
for i=skiplines+1:size(Ma,1)
Md(i-skiplines,1:22)=strsplit(Ma(i),[4 8 12 17 20 21 24 26 27 29 33 35 
36 38 42 45 46 48 53 55 56])'

end

Jan-Åge


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] mixed data type matrix

2017-03-24 Thread fujimoto2005
Dear All
Thanks for your helpful answers.
I could solve the problem.

Best regards.



--
View this message in context: 
http://mailinglists.scilab.org/mixed-data-type-matrix-tp4035956p4035979.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] {EXT} Re: add number arrays efficiently, how?

2017-03-24 Thread Rafael Guerra
with no logic to respect the SumArr orientation the following is even
simpler:

[SumArr(:); toAdd(:)]

Rgds,
Rafael



--
View this message in context: 
http://mailinglists.scilab.org/add-number-arrays-efficiently-how-tp4035946p4035978.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] {EXT} Re: add number arrays efficiently, how?

2017-03-24 Thread Dang Ngoc Chan, Christophe
Hello,

> De : Rafael Guerra
> Envoyé : vendredi 24 mars 2017 13:16
>
> Your code only works if the input arrays are  oriented similiarly (both 
> column or row vectors).
> [...]
>
> SumArr = [ 1 2 3 ];
>  toAdd = [ 7 8 9 10 ]'

You can transform it to line vectors (or column vectors) with matrix():

[matrix(SumArr, 1, size(SumArr, "*")), matrix(toAdd, 1, size(toAdd, "*"))]

Regards

--
Christophe Dang Ngoc Chan
Mechanical calculation engineer
This e-mail may contain confidential and/or privileged information. If you are 
not the intended recipient (or have received this e-mail in error), please 
notify the sender immediately and destroy this e-mail. Any unauthorized 
copying, disclosure or distribution of the material in this e-mail is strictly 
forbidden.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] add number arrays efficiently, how?

2017-03-24 Thread Rafael Guerra
Erhy,

Your code only works if the input arrays are  oriented similiarly (both
column or row vectors).
For the following input your code would not run:

SumArr = [ 1 2 3 ];  toAdd = [ 7 8 9 10 ]';
SumArr( (length(SumArr)+1) : (length(SumArr)+length(toAdd)) ) = toAdd;
!--error 15 
Submatrix incorrectly defined.

//You could try:

function y=add_b2a(a, b)
   [mx,k]=max(size(a));
   if k==1 then
  y= [a(:); b(:)];
   else
  y= [a(:); b(:)]';
   end
endfunction

// Examples:
SumArr = [ 1 2 3 ];  toAdd = [ 7 8 9 10 ]';
add_b2a(SumArr, toAdd)
 ans  =
1.2.3.7.8.9.10. 

SumArr = [ 1 2 3]';  toAdd = [ 7 8 9 10 ];
add_b2a(SumArr, toAdd)
 ans  =
1.   
2.   
3.   
7.   
8.   
9.   
10.  
 
Regards,
Rafael



--
View this message in context: 
http://mailinglists.scilab.org/add-number-arrays-efficiently-how-tp4035946p4035976.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] add number arrays efficiently, how?

2017-03-24 Thread Erhy
PabloF wrote
> May be im missing something, but i think in both cases you need to know
> the arrays in advance, dont you?
> 
> Also, i think  SumArr = [SumArr toAdd] has better performance...
> Perhaps im not understanding the question..

Perhaps merge arrays would be a appropriate subject.

If I code, I'm always uncertain about the orientation of the created array.
My first alternative works in any case.
 



--
View this message in context: 
http://mailinglists.scilab.org/add-number-arrays-efficiently-how-tp4035946p4035974.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] Building Scilab 6.0 with Visual Studio 2015?

2017-03-24 Thread Dirk Reusch
Hello,

Has anybody successfully build Scilab 6.0 from source for Windows 64Bit
using Visual Studio 2015?

If yes, does it work out-of-the-box following the instructions given
here https://wiki.scilab.org/Compilation%20of%20Scilab ?

Thanks,

Dirk
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] compiling scilab

2017-03-24 Thread Florian Blachère
Hello,

I can confirm that with a recent Ocaml compiler (4.04.0) on Archlinux
using the PKGBUILD from the AUR
(https://aur.archlinux.org/packages/scilab/) and with modelica activated
('--with-modelica') the build fails even with the '-j1' option.

Regards,

Florian

On 24/03/17 09:53, Clément David wrote:
> Hello all,
>
> Sorry for answering that late, I can offer more :) .
>
> The error comes from the buggy parallel OCaml compilation of the Modelica 
> compiler. This is a known
> issue and I currently failed to resolve it : you should compile with `make 
> -j1` to succeed.
>
> I was only able to reproduce it on system using OCaml 4 and it seems to be 
> related to a wrong ml/mli
> dependency order. Could you confirm that you are using the latest OCaml 
> version ?
>
> Thanks,
>
> --
> Clément
>
> Le jeudi 23 mars 2017 à 12:21 +0300, Nikolay Strelkov a écrit :
>> Dear Martin!
>>
>> First of all can't understand why you are trying to compile Scilab. 
>> You can get binary version, extract and use it.
>>
>> At second you can get Scilab from AUR. If you still willing to compile 
>> Scilab from sources you
>> should install its build dependencies. 
>> I think you can start building Scilab 6.0.0 (commit 
>> 22bd3a5c93489bce74fbaf25d19fe55aefca853c).
>> After successful build of 6.0.0 you can try newer revisions.
>>
>> I'm on Ubuntu 12.04.5 LTS. Here we use "apt-get build-dep scilab", 
>> "checkinstall" and so on. So I
>> can't offer more.
>>
>> --
>> With best regards,
>> Ph.D., assistant professor at MPEI,
>> IEEE member,
>> maintainer of Mathieu functions toolbox for Scilab,
>> Nikolay Strelkov.
>>
>> 2017-03-23 1:02 GMT+03:00 Martin Marmsoler :
>>> I'm using antergos and cloned the code from scilab website.
>>> GNU Make 4.2.1
>>> 4.10.3-1-ARCH
>>>
>>>
>>> 2017-03-22 22:29 GMT+01:00 Tim Wescott :
 On Wed, 2017-03-22 at 22:19 +0100, Martin Marmsoler wrote:
> Hello,
>
> I tried to compile scilab, but I get every the the following error:
>
> File "_none_", line 1:
> Error: Files ./src/xml2modelica/xMLParser.cmx
>and ./src/xml2modelica/linenum.cmx
>make inconsistent assumptions over implementation Linenum
>
> It's revision: 8e22c1833d5be739f39ca4008582952f2d76cfdc
> Tried also revision 37f503cc29e63e42902b4de384e9f7c064b76b92
 I do _not_ know the answer, but someone is going to ask you for
 platform, operating system, and the version of the tools that you're
 using.  Then they're going to want to know where you got your source
 code (unless it's obvious from the revision numbers).

 Sorry I can't offer more...

 --

 Tim Wescott
 www.wescottdesign.com
 Control & Communications systems, circuit & software design.
 Phone: 503.631.7815
 Cell:  503.349.8432



 ___
 users mailing list
 users@lists.scilab.org
 http://lists.scilab.org/mailman/listinfo/users

>>> ___
>>> users mailing list
>>> users@lists.scilab.org
>>> http://lists.scilab.org/mailman/listinfo/users
>>>
>> ___
>> users mailing list
>> users@lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users