24小时热门版块排行榜    

查看: 848  |  回复: 2

tonifcty

金虫 (初入文坛)

[求助] 帮忙把下面matlab m文件写成mathematica程序

就是一个对应的找位置的小程序,但是本人不会mathematica,求指导,多谢
前面赋值的部分搞成输入那种
function [Plate,Col,Row]=findplace(x,y,z)
%x:row,y:column,z:slide
%microarray column and row to microplate column and row
%set parameter

i=8;%microplate row number
j=10;%microplate column number
Ne=5; %Number of needle
length=4.5e4;%length of microarry
width=2.0e4;%width of microarry
stepx=250;
stepy=250;

%calculate
R=fix(width/stepy);
C=fix(length/stepx);% Total numbers of rows and columns of microarray
subcolumn=fix(C/Ne); % numbers of columns for each needle array

array=ceil(y/subcolumn);
time=R*(y-1-(array-1)*subcolumn)+x+(z-1)*R*subcolumn;% the number of spots
Plate=ceil(time/(i*j/Ne));

a=rem(time,(i*j/Ne));
if a==0
    Row=i;
    Col=array+1+Ne;
elseif a<=i
    Row=a;
    Col=array+1;
else
    Row=a-i;
    Col=array+1+Ne;
end
回复此楼

» 猜你喜欢

» 本主题相关价值贴推荐,对您同样有帮助:

已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

落叶撼秋风

新虫 (小有名气)

【答案】应助回帖

★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★ ★
感谢参与,应助指数 +1
tonifcty: 金币+50, ★★★★★最佳答案 2013-11-01 18:36:24
function [Plate,Col,Row]=findplace(x,y,z)
%x:row,y:column,z:slide
%microarray column and row to microplate column and row
%set parameter

i=8;%microplate row number
j=10;%microplate column number
Ne=5; %Number of needle
length=4.5e4;%length of microarry
width=2.0e4;%width of microarry
stepx=250;
stepy=250;

%calculate
R=fix(width/stepy);
C=fix(length/stepx);% Total numbers of rows and columns of microarray
subcolumn=fix(C/Ne); % numbers of columns for each needle array

array=ceil(y/subcolumn);
time=R*(y-1-(array-1)*subcolumn)+x+(z-1)*R*subcolumn;% the number of spots
Plate=ceil(time/(i*j/Ne));

a=rem(time,(i*j/Ne));
if a==0
    Row=i;
    Col=array+1+Ne;
elseif a<=i
    Row=a;
    Col=array+1;
else
    Row=a-i;
    Col=array+1+Ne;
end
2楼2013-11-01 18:28:46
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

xzczd

木虫 (小有名气)

楼主是自暴自弃了吗……选了一个完全无关的答案。如果只是翻译一下是很容易的:

findplace[x_, y_, z_] :=
With[{i = 8, j = 10, Ne = 5, length = 4.5 10^4, width = 2.0 10^4, stepx = 250, stepy = 250},
  Module[{r, c, a, subcolumn, array, time, plate, row, col},
   r = IntegerPart@(width/stepy);
   c = IntegerPart@(length/stepx);
   subcolumn = IntegerPart@(c/Ne);
   array = Ceiling@(y/subcolumn);
   time = r*(y - 1 - (array - 1)*subcolumn) + x + (z - 1)*r*subcolumn;
   plate = Ceiling@(time/(i*j/Ne));
   a = Mod[time, (i*j/Ne)];
   Which[ a == 0, row = i; col = array + 1 + Ne, a <= i, row = a;
    col = array + 1, True, row = a - i; col = array + 1 + Ne]; {plate, col, row}]]
小木虫Mathematica版块已毁(当然原本也不咋的),建议大家前往百度贴吧或Stackexchange。
3楼2014-07-04 12:19:32
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 tonifcty 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[考研] 一志愿武理085500机械专业总分300求调剂 +3 an10101 2026-03-24 7/350 2026-03-25 00:00 by 山鬼0-
[考研] 0805 316求调剂 +6 大雪深藏 2026-03-18 6/300 2026-03-24 22:13 by peike
[考研] 0856材料专硕353求调剂 +6 NIFFFfff 2026-03-20 6/300 2026-03-24 21:02 by hello七七
[考研] 资源与环境 调剂申请(333分) +7 holy J 2026-03-21 7/350 2026-03-24 17:24 by xiaohai104
[考研] 307求调剂 +5 超级伊昂大王 2026-03-24 5/250 2026-03-24 15:46 by 星空星月
[考研] 材料专硕英一数二306 +8 z1z2z3879 2026-03-18 8/400 2026-03-23 20:49 by baobaoye
[考研] 336化工调剂 +4 王大坦1 2026-03-23 5/250 2026-03-23 18:32 by allen-yin
[考研] 275求调剂 +6 shansx 2026-03-22 8/400 2026-03-22 15:27 by barlinike
[考研] 354求调剂 +7 Tyoumou 2026-03-18 10/500 2026-03-22 11:11 by 人来盛
[考研] 286求调剂 +10 Faune 2026-03-21 10/500 2026-03-21 23:34 by 314126402
[考研] 296求调剂 +4 www_q 2026-03-20 4/200 2026-03-21 17:26 by 学员8dgXkO
[考研] 266求调剂 +3 哇呼哼呼哼 2026-03-20 3/150 2026-03-21 16:46 by barlinike
[考研] 279求调剂 +5 红衣隐官 2026-03-21 5/250 2026-03-21 14:59 by lature00
[考研] 085601调剂 358分 +3 zzzzggh 2026-03-20 4/200 2026-03-21 10:21 by luoyongfeng
[考研] 一志愿华南师大 070300(化学)304分求调剂 +3 0703武芊慧雪304 2026-03-18 3/150 2026-03-21 00:48 by JourneyLucky
[考研] 一志愿中海洋材料工程专硕330分求调剂 +8 小材化本科 2026-03-18 8/400 2026-03-20 23:16 by JourneyLucky
[考研] 304求调剂 +7 司空. 2026-03-18 7/350 2026-03-20 23:08 by JourneyLucky
[考研] 295材料求调剂,一志愿武汉理工085601专硕 +5 Charlieyq 2026-03-19 5/250 2026-03-20 20:35 by JourneyLucky
[考研] 086500 325 求调剂 +3 领带小熊 2026-03-19 3/150 2026-03-20 18:38 by 尽舜尧1
[考研] 一志愿福大288有机化学,求调剂 +3 小木虫200408204 2026-03-18 3/150 2026-03-19 13:31 by houyaoxu
信息提示
请填处理意见