plant_table = readtable('secret_table.xlsx');
dest_points = table({"title1", "title2", "title3", "title4"}', {"33333","44444","55555","66666"}', 'VariableNames', {'Destination', 'BusNumber'});
aux_file_name = 'analysis.aux';
save_file_name = 'data.csv';
fid = fopen(aux_file_name,'w');
for idx = 1:height(dest_points)
fprintf(fid, '// %s Interface \r \r', string(dest_points.Destination(idx)));
for jdx = 1:height(plant_table)
fprintf(fid, 'Script PTDFCalculation \r ');
fprintf(fid, '{ \r ');
fprintf(fid,'CalculatePTDF([BUS %s], [BUS %s], AC); \r \r ',string(plant_table.BusNumber(jdx)), dest_points.BusNumber{idx});
fprintf(fid,'SetData(CaseInfo_Options, [KeyFieldsUse], ["Secondary"]); \r \r ');
fprintf(fid,'SaveDataWithExtra("%s",CSVCOLHEADER,Interface,[Name,Number,PTDF,MW,HasCTG,MonDirection],[],"filtername",[],[],[],); \r', save_file_name);
fprintf(fid, '} \r \r');
end
fprintf(fid, '\r');
end
fclose(fid);
4 Comments
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/502436-does-matlab-add-extra-data-to-text-files#comment_790973
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/502436-does-matlab-add-extra-data-to-text-files#comment_790973
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/502436-does-matlab-add-extra-data-to-text-files#comment_790981
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/502436-does-matlab-add-extra-data-to-text-files#comment_790981
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/502436-does-matlab-add-extra-data-to-text-files#comment_790984
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/502436-does-matlab-add-extra-data-to-text-files#comment_790984
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/502436-does-matlab-add-extra-data-to-text-files#comment_791021
Direct link to this comment
https://au.mathworks.com/matlabcentral/answers/502436-does-matlab-add-extra-data-to-text-files#comment_791021
Sign in to comment.