声振论坛

 找回密码
 我要加入

QQ登录

只需一步,快速开始

查看: 1423|回复: 3

[编程技巧] 关于xlswrite

[复制链接]
发表于 2009-3-21 17:40 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?我要加入

x
a b 为行向量
使用命令
d = {'Random', 'A/C type'; a' b' };
s = xlswrite('Arrival simulation.xls', d );
为什么不能将 a b 按列依次输出到表格呢


怎么样才能实现呢??
谢谢
回复
分享到:

使用道具 举报

发表于 2009-3-21 22:52 | 显示全部楼层
d = {'Random', 'A/C type'; a' b' };
Change to
d = cat(1,{'Random', 'A/C type'}, num2cell([a' b']) );

评分

1

查看全部评分

 楼主| 发表于 2009-3-28 21:31 | 显示全部楼层

xlswrite

r =
  Columns 1 through 10
    0.9485    0.4517    0.3317    0.0078    0.1658    0.8282    0.6434    0.3223    0.0264    0.3554
  Columns 11 through 20
    0.7439    0.2987    0.1812    0.4152    0.8673    0.6249    0.0552    0.4041    0.3020    0.1523
  Columns 21 through 30
    0.3092    0.0033    0.4374    0.6764    0.8229    0.7558    0.1626    0.5520    0.5251    0.9194
  Columns 31 through 40
    0.4419    0.0448    0.9646    0.0135    0.5520    0.9343    0.8986    0.6180    0.6999    0.9391
  Columns 41 through 50
    0.4521    0.1767    0.6168    0.5184    0.3645    0.7733    0.8283    0.3184    0.5960    0.7818
  Columns 51 through 60
    0.0336    0.8570    0.6826    0.8019    0.9177    0.3881    0.4720    0.0881    0.9251    0.6785

p =
HMMLMHMMLMMMMMHMLMMMMLMMHMMMMHMLHLMHHMMHMMMMMMHMMMLHMHHMMLHM

d =
  Columns 1 through 16
   120    80   120    76    80   120    80   120    76    80    80    80    80    80   120   120
  Columns 17 through 32
    76    80    80    80   120    76    80    80   120    80    80    80    80   120   120    76
  Columns 33 through 48
    75    76    80    75   120    80    80   120    80    80    80    80    80    80   120    80
  Columns 49 through 60
    80   120    76   120    80    75   120    80   120    76   120     0

to =
  Columns 1 through 16
    50    50    50    50    50    50    50    50    50    50    50    50    50    50    50    50
  Columns 17 through 32
    50    50    50    50    50    50    50    50    50    50    50    50    50    50    50    50
  Columns 33 through 48
    50    50    50    50    50    50    50    50    50    50    50    50    50    50    50    50
  Columns 49 through 60
    50    50    50    50    50    50    50    50    50    50    50    50

gr =
  Columns 1 through 9
    2.8333    2.1667    2.8333    2.1000    2.1667    2.8333    2.1667    2.8333    2.1000
  Columns 10 through 18
    2.1667    2.1667    2.1667    2.1667    2.1667    2.8333    2.8333    2.1000    2.1667
  Columns 19 through 27
    2.1667    2.1667    2.8333    2.1000    2.1667    2.1667    2.8333    2.1667    2.1667
  Columns 28 through 36
    2.1667    2.1667    2.8333    2.8333    2.1000    2.0833    2.1000    2.1667    2.0833
  Columns 37 through 45
    2.8333    2.1667    2.1667    2.8333    2.1667    2.1667    2.1667    2.1667    2.1667
  Columns 46 through 54
    2.1667    2.8333    2.1667    2.1667    2.8333    2.1000    2.8333    2.1667    2.0833
  Columns 55 through 60
    2.8333    2.1667    2.8333    2.1000    2.8333         0

tfs =
  Columns 1 through 9
         0    2.8333    5.0000    7.8333    9.9333   12.1000   14.9333   17.1000   19.9333
  Columns 10 through 18
   22.0333   24.2000   26.3667   28.5333   30.7000   32.8667   35.7000   38.5333   40.6333
  Columns 19 through 27
   42.8000   44.9667   47.1333   49.9667   52.0667   54.2333   56.4000   59.2333   61.4000
  Columns 28 through 36
   63.5667   65.7333   67.9000   70.7333   73.5667   75.6667   77.7500   79.8500   82.0167
  Columns 37 through 45
   84.1000   86.9333   89.1000   91.2667   94.1000   96.2667   98.4333  100.6000  102.7667
  Columns 46 through 54
  104.9333  107.1000  109.9333  112.1000  114.2667  117.1000  119.2000  122.0333  124.2000
  Columns 55 through 60
  126.2833  129.1167  131.2833  134.1167  136.2167  139.0500

tfe =
  Columns 1 through 9
    2.8333    5.0000    7.8333    9.9333   12.1000   14.9333   17.1000   19.9333   22.0333
  Columns 10 through 18
   24.2000   26.3667   28.5333   30.7000   32.8667   35.7000   38.5333   40.6333   42.8000
  Columns 19 through 27
   44.9667   47.1333   49.9667   52.0667   54.2333   56.4000   59.2333   61.4000   63.5667
  Columns 28 through 36
   65.7333   67.9000   70.7333   73.5667   75.6667   77.7500   79.8500   82.0167   84.1000
  Columns 37 through 45
   86.9333   89.1000   91.2667   94.1000   96.2667   98.4333  100.6000  102.7667  104.9333
  Columns 46 through 54
  107.1000  109.9333  112.1000  114.2667  117.1000  119.2000  122.0333  124.2000  126.2833
  Columns 55 through 60
  129.1167  131.2833  134.1167  136.2167  139.0500         0
>> s = cat(1,{'Random', 'A/C type','Deps gap','Time on runway','Gap+runway','Time from start','Time from end'},num2cell([r' p' d' to' gr' tfs' tfe']));
>> k = xlswrite('Departure simulation1.xls', s )



运行结果怎么是乱码呢?并且个别列没有显示出来?运行结果如下:(第一列无显示,其它列乱码,其中个别地方是空白)
RandomA/C typeDeps gapTime on runwayGap+runwayTime from startTime from end
Hx2
MP2
Mx2
LL2
MP2
Hx2
MP2
Mx2
LL2
MP2
发表于 2009-3-28 22:13 | 显示全部楼层
自己先修改好可执行的程序, 方便别人试试!
还有建议楼主先看下本版规则并加强发问题方式!

评分

1

查看全部评分

您需要登录后才可以回帖 登录 | 我要加入

本版积分规则

QQ|小黑屋|Archiver|手机版|联系我们|声振论坛

GMT+8, 2024-7-1 11:11 , Processed in 0.088989 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表