-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmax_proj_checker_deleter.m
More file actions
executable file
·119 lines (93 loc) · 5.21 KB
/
Copy pathmax_proj_checker_deleter.m
File metadata and controls
executable file
·119 lines (93 loc) · 5.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
function [sorted_txt,message_MAX_PROJS,tracking_max_projs,message_MAX_PROJS2,message_MAX_PROJS3] = ...
max_proj_checker_deleter (proj_name,max_proj_checker,N_students,sorted_txt,proj_sent_no,BeforeOrAfter)
message_MAX_PROJS3 = [];
if BeforeOrAfter == "BeforeCond1" || BeforeOrAfter == "BeforeCond2"
BeforeOrAfter = 'Before';
extracondition = "Yes";
else
BeforeOrAfter;
extracondition = "No";
end
% [~,idx]=unique( strcat(proj_name(:,1),proj_name(:,2)) , 'rows');
% proj_name=proj_name(idx,:)
for u = 1 : size(proj_name,1)
proj_name{u,1} = proj_name{u,1}(1:end-1);
end
%proj_name = Assigned_projs_rolls_with_gui_codes(:,1);
if proj_sent_no > 0
disp('need to check')
end
for i = 1 : size(proj_name,1)
proj_name(i);
repeation = find(strncmpi(proj_name(i),proj_name,strlength(proj_name(i))));
proj_occurence = length(repeation);
checking_with_base =...
find(strncmpi(proj_name(i),max_proj_checker(:,1),strlength(proj_name(i))));
if str2double(max_proj_checker(checking_with_base,2)) == proj_occurence && BeforeOrAfter == "After"
msg = sprintf('Prof. '+string(proj_name{i}(1:end-4))+' Project Allotment Max Limit Reached');
for m = 1: N_students
extracted_txt = sorted_txt(m,:);
extracted_txt(find(contains(extracted_txt,proj_name(i)))) = [];
new_sorted_txt(m,:) = extracted_txt;
clear extracted_txt
end
sorted_txt = new_sorted_txt;
clear new_sorted_txt
elseif str2double(max_proj_checker(checking_with_base,2)) - proj_occurence < 0 % This is a special case where the project is not assigned but came for checking what is the limit.
msg = sprintf('Prof. '+string(proj_name{i}(1:end-4))+' Project Allotment Max Limit Reached');
for m = 1: N_students
extracted_txt = sorted_txt(m,:);
extracted_txt(find(contains(extracted_txt,proj_name(i)))) = [];
new_sorted_txt(m,:) = extracted_txt;
clear extracted_txt
end
sorted_txt = new_sorted_txt;
clear new_sorted_txt
end
if str2double(max_proj_checker(checking_with_base,2))-proj_occurence > 0
message_MAX_PROJS='Only'+string(str2double(max_proj_checker(checking_with_base,2)) - (proj_occurence))+'Left';
else
message_MAX_PROJS='NoneLeft';
end
if str2double(max_proj_checker(checking_with_base,2))-proj_occurence + proj_sent_no > 0 && extracondition == 'Yes'
message_MAX_PROJS2 = 'Only'+string(str2double(max_proj_checker(checking_with_base,2))...
- (proj_occurence) + proj_sent_no-1)+'Left'; % If projects are sent as an array
message_MAX_PROJS3 = 'Only'+string(str2double(max_proj_checker(checking_with_base,2))...
- (proj_occurence) + proj_sent_no -1)+'Left';
elseif str2double(max_proj_checker(checking_with_base,2))-proj_occurence + proj_sent_no == 0 && BeforeOrAfter == "Before"
message_MAX_PROJS2 = 'Only'+string(str2double(max_proj_checker(checking_with_base,2))...
- (proj_occurence) + proj_sent_no)+'Left'; % If projects are sent as an array
message_MAX_PROJS3 = 'Only'+string(str2double(max_proj_checker(checking_with_base,2))...
- (proj_occurence) + proj_sent_no + 1)+'Left';
elseif str2double(max_proj_checker(checking_with_base,2))-proj_occurence + proj_sent_no == 0 && BeforeOrAfter == "After"
message_MAX_PROJS2 = 'NoneLeft'; % If projects are sent as an array
message_MAX_PROJS3 = 'NoneLeft';
elseif ...
str2double(max_proj_checker(checking_with_base,2))-...
proj_occurence + proj_sent_no >0 && BeforeOrAfter == "Before" && extracondition == 'No'
message_MAX_PROJS2 = 'Only'+string(str2double(max_proj_checker(checking_with_base,2))...
- (proj_occurence) + proj_sent_no)+'Left'; % If projects are sent as an array
message_MAX_PROJS3 = 'Only'+string(str2double(max_proj_checker(checking_with_base,2))...
- (proj_occurence) + proj_sent_no + 1)+'Left';
elseif ...
str2double(max_proj_checker(checking_with_base,2))-...
proj_occurence + proj_sent_no >0 && BeforeOrAfter == "After" && extracondition == 'No'
message_MAX_PROJS2 = 'Only'+string(str2double(max_proj_checker(checking_with_base,2))...
- (proj_occurence) + proj_sent_no-1)+'Left'; % If projects are sent as an array
message_MAX_PROJS3 = 'Only'+string(str2double(max_proj_checker(checking_with_base,2))...
- (proj_occurence) + proj_sent_no )+'Left';
end
if length(message_MAX_PROJS3)<1
msg = 'This can be due to improper closing of previous windows. Either use done or any other buttons to close. But do not press the close button on the top of the window to close a window.';
error(msg);
end
tracking_max_projs(i,:) = [proj_name(i) message_MAX_PROJS3];
%proj_name(
end
% if proj_name == ["NaN" "NaN"]
% tracking_max_projs = [];
% message_MAX_PROJS = [];
% message_MAX_PROJS2 = [];
% message_MAX_PROJS3=[];
% end
end