how a access array element and send to user for task

조회 수: 1 (최근 30일)
Sanjoy Dey
Sanjoy Dey 2019년 3월 25일
댓글: Jan 2019년 3월 26일
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
Sanjoy Dey
Sanjoy Dey 2019년 3월 25일
편집: Sanjoy Dey 2019년 3월 25일
suppose somewhere held an accident and we want to click the picture of that place this is the task...we want to involve some person(user) who will capture the picture.Now we will select those person on the basis of there provided data_quality(depends on capturing image).
in this code we already calculated the data quality and we have arranged on decending order.
now i want to assign the task on the basis of highest data quality that's provides user.
In the output section user2 give com_data_quality 0.6300 for task1
then we want to send task1 to the user2
similarly
user2 give com_data_quality 0.7500 for task2
then we want to send task2 to the user2
user2 give com_data_quality 0.5400 for task3
then we want to send task3 to the user2
this is the concept of assign the task...
we have already stored the value with highest quality in array in decending order...
we want send the task to that user who is providing the highest data quality that's why i want to write a matlab code for this concept....Please help me
Thank you
Jan
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 CenterFile Exchange에서 Logical에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by