function rotate2(filename, theta, scale) res = fopen(filename, 'r'); if res < 0 error('file not found') end sizeData = [2 Inf]; Data = fscanf(res, '%f %f', sizeData); Data = Data'; fclose(res); plot(Data(:,1), Data(:,2)) hold on; Scaled = Data * scale; RotationMatrix = [cos(theta) -sin(theta); sin(theta) cos(theta)]; Rotated = Scaled * RotationMatrix; plot(Rotated(:,1), Rotated(:,2)) Rotated = Rotated'; answer = questdlg('Save coordinates to file?','Save to file',... 'Yes','No','Yes'); if(strcmp(answer, 'Yes')) Result = fopen('D:\Codes\MATLAB\results.txt', 'w'); fprintf(Result, 'X: %.3f Y: %.3f\r\n', Rotated); fclose(Result); end end