scilab 数组和字符串

数组存储顺序

-->a = [1:3;4:6];
-->disp(a);

1 2 3
4 5 6
他在内存的存储顺序是
【1,4,2,5,3,6】
可以认为是转秩存储的。

字符串
t=sci2exp(a [,nam] [,lmax]) // converts an expression to a string
[out,in,text]=string(x)
strcat - catenate character strings
length()
[nr,nc]=size(x)
ind=strindex(str1,str2)
printf(format,value_1,…,value_n)
str=sprintf(format,value_1,…,value_n)

sci2exp(poly([1 0 3 4],'s'),'fi')
x=123.356; 'Result is '+string(x)
strcat(string(1:10),',')
['this','is'; 'a 2x2','matrix']  "matrix"=="mat"+"rix"
k=strindex('SCI/demos/scicos','/')
xnumb(x,500*ones(x),[10,20,35],1)
xstring(0.1,0.1,alphabet)
printf('Result is:\nalpha=%f",0.535)
sprintf('%3d Fahrenheit = %6.1f Celsius',fahr,(5/9)*(fahr-32)) 

函数操作
[H]= eval(Z) evaluation of a matrix of strings
evstr - evaluation of expressions
find - find indices of boolean vector or matrix true elements
function [y1,…,yn]=foo(x1,…,xm)
function [y1,…,yn,varargout]=foo(x1,…,xm,varargin)
[f,e]=frexp(x)

deff("[ydot]=f(t,y)","ydot=y^2-y*sin(t)+cos(t)")
y0=0;t0=0;t=0:0.1:%pi;
y=ode(y0,t0,t,f)
plot(t,y)
a=1; b=2; Z=['a','sin(b)'] ; eval(Z)  //returns the matrix [1,0.909];
a=1; b=2; Z=['a','b'] ; evstr(Z) 
A=rand(1,20);
w=find(A<0.4)
A(w)
w=find(A>100) 
[f,e]=frexp([1,%pi,-3,%eps])

//inline definition (see function)
function [x,y]=myfct(a,b)
x=a+b
y=a-b
endfunction

[x,y]=myfct(3,2)

//inline definition (see deff)
deff('[x,y]=myfct(a,b)',['x=a+b';
                         'y=a-b'])
// definition in an ascii file (see exec)
exec SCI/macros/elem/asin.sci;

// definition in an ascii file (see getf)
getf SCI/macros/elem/asin.sci;
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值