how a access array element and send to user for task

1 view (last 30 days)
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 Comments
Sanjoy Dey
Sanjoy Dey on 25 Mar 2019
Edited: Sanjoy Dey on 25 Mar 2019
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 on 26 Mar 2019
@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.

Sign in to comment.

Answers (0)

Categories

Find more on File Operations in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!