Cody

Mrikwood

16951
Rank
2
Badges
120
Score
1 – 16 of 16

Mrikwood submitted a Comment to Solution 2715081

function val=longrun(a) a_len=length(a); %计算a的长度 c=ones(a_len,1); %初始化对应位置的连续次数 for num_a=1:(a_len-1) n_val=1; for next_a=(num_a+1):a_len if a(num_a)==a(next_a) %如果这个数字和后面的数字相等,则n_val+1,并进行下一次循环 n_val=n_val+1; c(num_a)=n_val; else c(num_a)=n_val; %如果这个数字和后面数字不等,则把当前的n_val赋值给对应数字的连续次数,并跳出内层for循环 break end end end a_conti=max(c); %找出c数组中最大的连续次数 max_location=find(c==a_conti); %对应最大连续次数的位置 val=a(max_location); %找出对应在a中的位置 end

on 20 Jul 2020

Mrikwood submitted a Comment to Solution 2714379

Although my method is stupid and complicated,it still works. function X = rescale_scores(X) rown=length(X(1,:)); cn=length(X(:,1)); for c=1:cn if X(c,rown)>=90 A=rescale([90,X(c,rown),100],3,4); X(c,rown)=A(2); elseif X(c,rown)>=80 A=rescale([80,X(c,rown),90],2,3); X(c,rown)=A(2); elseif X(c,rown)>=70 A=rescale([70,X(c,rown),80],1,2); X(c,rown)=A(2); else A=rescale([60,X(c,rown),70],0,1); X(c,rown)=A(2); end end end

on 20 Jul 2020

Mrikwood submitted a Comment to Solution 2712270

function z = in_prod(x,y) if length(x(1,:))==length(y(:,1)) z=x*y; else z="Have you checked the inner dimensions?" end end

on 19 Jul 2020

Mrikwood received Commenter badge for Solution 2712015

on 19 Jul 2020

Mrikwood submitted a Comment to Solution 2712015

function bmi = bmi_calculator(hw) hwm=hw(:,1)*2.54/100; hwk=hw(:,2)/2.2; bmi = hwk./(hwm.*hwm); end

on 19 Jul 2020

Mrikwood received Solver badge for Solution 2711652

on 19 Jul 2020

1 – 16 of 16