how a access array element and send to user for task
조회 수: 1 (최근 30일)
이전 댓글 표시
This is my code
% Structure of array user set
user(1).will = 0.5;
user(1).rep = 1;
user(1).bid = [9,8,7];
user(1).inter_time=4;
user(2).will = 0.9;
user(2).rep = 0.6;
user(2).bid = [6,5,7];
user(2).inter_time=7;
% Structure of Array of user set
task(1).bud = 8;
task(1).qua = 1;
task(2).bud = 9;
task(2).qua = 2;
task(3).bud = 7;
task(3).qua = 1;
s = zeros(1,3*2);
for i=1:2
for j=1:3
%fprintf('i=%d j=%d\n',i,j);
if(not (user(i).bid(j)<=task(j).bud))
continue;
end
com_data_quality = (user(i).will*user(i).rep/user(i).bid(j)*user(i).inter_time);
s((i-1)*3+j)= com_data_quality;
b = sort(s,'descend');
fprintf('value is %f task is=%d user is=%d \n', com_data_quality,j,i);
end
end
OUTPUT:
value is 0.250000 task is=2 user is=1
value is 0.285714 task is=3 user is=1
value is 0.630000 task is=1 user is=2
value is 0.756000 task is=2 user is=2
value is 0.540000 task is=3 user is=2
b =
0.7560 0.6300 0.5400 0.2857 0.2500 0 (decending order)
Now my question is here array b is in decending order of com_data_quality,here user 2 for task 2 give the highest data quality i want to send this task for user 2...and then assign the task to user with highest data quality.
how i write this code for this process.
Please help me.
댓글 수: 5
Jan
2019년 3월 26일
@Sanjoy Dey: These explanations are still to abstract to understand, what you want to do. There is no Matlab command to perform a "involve some person" or "send task 1 to user 2".
Matlab could send an email, if the address is known. Or you can create a struct, which contains the field "solvedBy" and set the contents to the char vector "user 1". Maybe you want to store a specific file in a certain folder. You still did not mention, what the code should do.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!