print or output the selected residues in pymol - pymol

I am following this step to print the residues that I selected in pymol, and I found that some of the residues got iterated more than 1 time. Does anyone know what the problem is?
ls = []
iterate selected, ls.append((resi, resn))
print ls
The selected residues are 29 amino acids in total, and here is the result of the output.
[('1', 'MET'), ('2', 'PHE'), ('3', 'ILE'), ('4', 'PHE'), ('5', 'LEU'), ('6', 'LEU'), ('7', 'PHE'), ('8', 'LEU'), ('9', 'THR'), ('10', 'LEU'), ('11', 'THR'), ('12', 'SER'), ('13', 'GLY'), ('14', 'SER'), ('15', 'ASP'), ('16', 'LEU'), ('17', 'ASP'), ('18', 'ARG'), ('18', 'ARG'), ('18', 'ARG'), ('18', 'ARG'), ('18', 'ARG'), ('18', 'ARG'), ('18', 'ARG'), ('18', 'ARG'), ('18', 'ARG'), ('18', 'ARG'), ('18', 'ARG'), ('19', 'CYS'), ('19', 'CYS'), ('19', 'CYS'), ('19', 'CYS'), ('19', 'CYS'), ('19', 'CYS'), ('20', 'THR'), ('20', 'THR'), ('20', 'THR'), ('20', 'THR'), ('20', 'THR'), ('20', 'THR'), ('20', 'THR'), ('21', 'THR'), ('21', 'THR'), ('21', 'THR'), ('21', 'THR'), ('21', 'THR'), ('21', 'THR'), ('21', 'THR'), ('22', 'PHE'), ('22', 'PHE'), ('22', 'PHE'), ('22', 'PHE'), ('22', 'PHE'), ('22', 'PHE'), ('22', 'PHE'), ('22', 'PHE'), ('22', 'PHE'), ('22', 'PHE'), ('22', 'PHE'), ('23', 'ASP'), ('23', 'ASP'), ('23', 'ASP'), ('23', 'ASP'), ('23', 'ASP'), ('23', 'ASP'), ('23', 'ASP'), ('23', 'ASP'), ('24', 'ASP'), ('24'
, 'ASP'), ('24', 'ASP'), ('24', 'ASP'), ('24', 'ASP'), ('24', 'ASP'), ('24', 'ASP'), ('24', 'ASP'), ('25', 'VAL'), ('25', 'VAL'), ('25', 'VAL'), ('25', 'VAL'), ('25', 'VAL'), ('25', 'VAL'), ('25', 'VAL'), ('26', 'GLN'), ('26', 'GLN'), ('26', 'GLN'), ('26', 'GLN'), ('26', 'GLN'), ('26', 'GLN'), ('26', 'GLN'), ('26', 'GLN'), ('26', 'GLN'), ('27', 'ALA'), ('27', 'ALA'), ('27', 'ALA'), ('27', 'ALA'), ('27', 'ALA'), ('28', 'PRO'), ('28', 'PRO'), ('28', 'PRO'), ('28', 'PRO'), ('28', 'PRO'), ('28', 'PRO'), ('28', 'PRO'), ('29', 'ASN'), ('29', 'ASN'), ('29', 'ASN'), ('29', 'ASN'), ('29', 'ASN'), ('29', 'ASN'), ('29', 'ASN'), ('29', 'ASN')]

Pymol iterates over every atom. Restrict search to one atom per residue like this:
iterate selected and name CA, ls.append((resi, resn))
Or, better yet, have the whole seqeunce in one line like this:
iterate selected and name CA, print (resi, resn)

Related

PyQT5 change stylesheet if condition is met

from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton, QPlainTextEdit, QVBoxLayout, QWidget
from PyQt5.QtCore import QProcess
import subprocess
import sys
import time
import datetime
current_time = datetime.datetime.now()
current_time = current_time.strftime('%Y-%m-%d %H:%M')
class TextUpdate():
def watch_list(self):
self = open(r"C:\Users\Administrator\Desktop\stat_arb\gui\watchlist.txt", 'r').read()
return self
def order_history(self):
self = open(r"C:\Users\Administrator\Desktop\stat_arb\gui\orderhistory.txt", 'r').read()
return self
def re_turn(self):
self = open(r"C:\Users\Administrator\Desktop\stat_arb\gui\return.txt", 'r').read()
return self
def net_value(self):
self = open(r"C:\Users\Administrator\Desktop\stat_arb\gui\netvalue.txt", 'r').read()
return self
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(915, 413)
MainWindow.setStyleSheet(
"background-color: rgb(42, 42 , 42)")
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.p = None
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
self.frame = QtWidgets.QFrame(self.centralwidget)
self.frame.setStyleSheet(
"background-color: rgb(42, 42 , 42)")
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame.setObjectName("frame")
self.frame_2 = QtWidgets.QFrame(self.frame)
self.frame_2.setGeometry(QtCore.QRect(20, 30, 411, 221))
self.frame_2.setStyleSheet(
"background-color: #202020;\n"
"border-radius: 12px")
self.frame_2.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame_2.setObjectName("frame_2")
self.watch_text = QtWidgets.QPlainTextEdit(self.frame_2)
self.watch_text.setGeometry(QtCore.QRect(10, 40, 391, 121))
self.watch_text.setMouseTracking(False)
self.watch_text.setStyleSheet(
"border:0;\n"
"font-size: 11px;\n"
"color: #9e9e9e")
self.watch_text.setBackgroundVisible(False)
self.watch_text.setObjectName("watch_text")
self.watch_label = QtWidgets.QPlainTextEdit(self.frame_2)
self.watch_label.setGeometry(QtCore.QRect(10, 10, 391, 31))
self.watch_label.setStyleSheet(
"border:0;\n"
"font-size: 10px;\n"
"font-weight: bold;\n"
"color: #ffffff")
self.watch_label.setObjectName("watch_label")
self.start_button = QtWidgets.QPushButton(self.frame_2)
self.start_button.setGeometry(QtCore.QRect(100, 180, 221, 28))
self.start_button.setStyleSheet(
"background-color: #61ac3e;\n"
"border-radius: 8px;\n"
"font-size: 10px;\n"
"font-weight: bold;\n"
"color: #ffffff")
self.start_button.setObjectName("start_button")
self.frame_3 = QtWidgets.QFrame(self.frame)
self.frame_3.setGeometry(QtCore.QRect(20, 260, 411, 101))
self.frame_3.setStyleSheet(
"background-color: #202020;\n"
"border-radius: 12px")
self.frame_3.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame_3.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame_3.setObjectName("frame_3")
self.output_text = QtWidgets.QPlainTextEdit(self.frame_3)
self.output_text.setGeometry(QtCore.QRect(10, 40, 391, 51))
self.output_text.setMouseTracking(False)
self.output_text.setStyleSheet(
"border:0;\n"
"font-size: 11px;\n"
"color: #9e9e9e;")
self.output_text.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
self.output_text.setBackgroundVisible(False)
self.output_text.setObjectName("output_text")
self.output_label = QtWidgets.QPlainTextEdit(self.frame_3)
self.output_label.setGeometry(QtCore.QRect(10, 10, 391, 31))
self.output_label.setStyleSheet("border:0;\n"
"font-size: 10px;\n"
"font-weight: bold;\n"
"color: #ffffff")
self.output_label.setObjectName("output_label")
self.frame_4 = QtWidgets.QFrame(self.frame)
self.frame_4.setGeometry(QtCore.QRect(450, 140, 411, 221))
self.frame_4.setStyleSheet(
"background-color: #202020;\n"
"border-radius: 12px")
self.frame_4.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame_4.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame_4.setObjectName("frame_4")
self.order_text = QtWidgets.QPlainTextEdit(self.frame_4)
self.order_text.setGeometry(QtCore.QRect(10, 40, 391, 161))
self.order_text.setMouseTracking(False)
self.order_text.setStyleSheet(
"border:0;\n"
"font-size: 11px;\n"
"color: #9e9e9e")
self.order_text.setBackgroundVisible(False)
self.order_text.setObjectName("order_text")
self.order_label = QtWidgets.QPlainTextEdit(self.frame_4)
self.order_label.setGeometry(QtCore.QRect(10, 10, 391, 31))
self.order_label.setStyleSheet(
"border:0;\n"
"font-size: 10px;\n"
"font-weight: bold;\n"
"color: #ffffff")
self.order_label.setObjectName("order_label")
self.frame_5 = QtWidgets.QFrame(self.frame)
self.frame_5.setGeometry(QtCore.QRect(450, 30, 411, 101))
self.frame_5.setStyleSheet(
"background-color: #202020;\n"
"border-radius: 12px")
self.frame_5.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.frame_5.setFrameShadow(QtWidgets.QFrame.Raised)
self.frame_5.setObjectName("frame_5")
self.nav_text = QtWidgets.QPlainTextEdit(self.frame_5)
self.nav_text.setGeometry(QtCore.QRect(10, 40, 181, 41))
self.nav_text.setMouseTracking(False)
self.nav_text.setBackgroundVisible(False)
self.nav_text.setObjectName("nav_text")
self.nav_text.setStyleSheet(
"border:0;\n"
"font-size: 24px;\n"
"color: #1a62dd")
self.nav_label = QtWidgets.QPlainTextEdit(self.frame_5)
self.nav_label.setGeometry(QtCore.QRect(10, 10, 181, 31))
self.nav_label.setStyleSheet(
"border:0;\n"
"font-size: 10px;\n"
"font-weight: bold;\n"
"color: #ffffff")
self.nav_label.setObjectName("nav_label")
self.return_text = QtWidgets.QPlainTextEdit(self.frame_5)
self.return_text.setGeometry(QtCore.QRect(210, 40, 181, 41))
self.return_text.setMouseTracking(False)
self.return_text.setBackgroundVisible(False)
self.return_text.setObjectName("return_text")
self.return_text.setStyleSheet(
"border:0;\n"
"font-size: 24px;\n"
"color: #9e9e9e")
self.return_label = QtWidgets.QPlainTextEdit(self.frame_5)
self.return_label.setGeometry(QtCore.QRect(210, 10, 181, 31))
self.return_label.setStyleSheet(
"border:0;\n"
"font-size: 10px;\n"
"font-weight: bold;\n"
"color: #ffffff")
self.return_label.setObjectName("return_label")
self.gridLayout.addWidget(self.frame, 0, 0, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
self.timer = QtCore.QTimer()
self.timer.start(5)
self.timer.timeout.connect(lambda:self.watch_text.setPlainText(TextUpdate().watch_list()))
self.timer.timeout.connect(lambda:self.order_text.setPlainText(TextUpdate().order_history()))
self.timer.timeout.connect(lambda:self.return_text.setPlainText(TextUpdate().re_turn()))
self.timer.timeout.connect(lambda:self.nav_text.setPlainText(TextUpdate().net_value()))
self.start_button.pressed.connect(self.start_process)
self.output_text.setReadOnly(True)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.watch_label.setPlainText(_translate("MainWindow", " WATCHLIST"))
self.start_button.setText(_translate("MainWindow", "START"))
self.output_label.setPlainText(_translate("MainWindow", " OUTPUT"))
self.order_label.setPlainText(_translate("MainWindow", " ORDER HISTORY"))
self.nav_label.setPlainText(_translate("MainWindow", " NET VALUE"))
self.return_label.setPlainText(_translate("MainWindow", " %RETURN"))
def message(self, s):
self.output_text.appendPlainText(s)
def start_process(self):
if self.p is None: # No process running.
self.message(f'[STATUS] {current_time} Initializing process...')
self.p = QProcess() # Keep a reference to the QProcess (e.g. on self) while it's running.
self.p.readyReadStandardOutput.connect(self.handle_stdout)
self.p.readyReadStandardError.connect(self.handle_stderr)
self.p.stateChanged.connect(self.handle_state)
self.p.finished.connect(self.process_finished) # Clean up once complete.
# environment path,script.py path
self.p.start(r'C:\Users\Administrator\PycharmProjects\pythonProject\venv\Scripts\python.exe',
[r"C:\Users\Administrator\Desktop\stat_arb\31b_aug.py"])
def handle_stderr(self):
data = self.p.readAllStandardError()
stderr = bytes(data).decode("utf8")
self.message(stderr)
def handle_stdout(self):
data = self.p.readAllStandardOutput()
stdout = bytes(data).decode("utf8")
self.message(stdout)
def handle_state(self, state):
states = {
QProcess.NotRunning: 'Not running...',
QProcess.Starting: 'Starting...',
QProcess.Running: 'Running...',
}
state_name = states[state]
self.message(f'[STATUS] {current_time} {state_name}')
def process_finished(self):
self.message("Process finished.")
self.p = None
def get_termi_futu():
subprocess.call("taskkill /F /IM FutuOpenD.exe")
print('[DISCONNECTED]', current_time, ' Connection status. Trading account is disconnected.')
if name == "main":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
app.exec_()
get_termi_futu()
the %return is updating font color only if the GUI is restarted.
figure it out and added this:
def font_color():
if float(TextUpdate().re_turn()) > 0:
self = ("border:0;\n"
"font-size: 24px;\n"
"color: #23df0a")
return self
else:
self = (
"border:0;\n"
"font-size: 24px;\n"
"color: #e41a13")
return self
self.timer = QtCore.QTimer()
self.timer.start(5)
self.timer.timeout.connect(lambda:self.return_text.setStyleSheet(font_color()))

How to remove focus from QLineEdit when somewhere else clicked on the window PyQt5

Problem
I want to Remove the Focus from QLineEdit when I click somewhere else on the window.
I'm using PyQt5 in Python 3.9.7 on Windows 10
I've also searched about this on google, youtube and stackoverflow. But Seems the api was outdated/Not for PyQt5.
Code
I was Making a URL Shortener for Educational Purpose Only (Cz I'm Beginner:)
and I'm using My own class Entrybox which is parent to QLineEdit
Here is the code:
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QMessageBox
from requests import get
from pyperclip import copy
from keyboard import add_hotkey
class Entrybox(QtWidgets.QLineEdit):
pass
class Ui_window(object):
def setupUi(self, window):
self.win=window
self.win.setFixedSize(400, 247)
font = QtGui.QFont()
font.setFamily("Microsoft YaHei")
font.setPointSize(10)
window.setFont(font)
window.setAutoFillBackground(False)
window.setStyleSheet("background-color: #484848;")
window.setUnifiedTitleAndToolBarOnMac(False)
self.centralwidget = QtWidgets.QWidget(window)
self.centralwidget.setObjectName("centralwidget")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(0, 10, 400, 31))
font = QtGui.QFont()
font.setFamily("Microsoft YaHei")
font.setPointSize(20)
self.label.setFont(font)
self.label.setStyleSheet("color:#fff;")
self.label.setAlignment(QtCore.Qt.AlignCenter)
self.label.setObjectName("label")
self.boxurl = Entrybox(self.centralwidget)
self.boxurl.setGeometry(QtCore.QRect(10, 60, 380, 31))
font = QtGui.QFont()
font.setFamily("Microsoft YaHei")
font.setPointSize(12)
self.boxurl.setFont(font)
self.boxurl.setStyleSheet("Entrybox {\n"
"background-color: #595959;\n"
"border:0px;\n"
"color:#ffffff;\n"
"selection-color: #ffffff;\n"
"selection-background-color: #484848;\n"
"border-radius: 15px;\n"
"}\n"
"Entrybox:hover {\n"
"background-color: #636363;\n"
"}\n"
"Entrybox:focus {\n"
"background-color: #636363;\n"
"}")
self.boxurl.setAlignment(QtCore.Qt.AlignCenter)
self.boxurl.setObjectName("boxurl")
self.gobtn = QtWidgets.QPushButton(self.centralwidget)
self.gobtn.setGeometry(QtCore.QRect(160, 160, 81, 41))
font = QtGui.QFont()
font.setFamily("Microsoft YaHei")
font.setPointSize(15)
font.setBold(True)
font.setWeight(75)
self.gobtn.setFont(font)
self.gobtn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.gobtn.setStyleSheet("QPushButton {\n"
"background-color: #505050;\n"
"border:0px;\n"
"color:#ffffff;\n"
"border-radius:15px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: #595959;\n"
"}\n"
"QPushButton:pressed {\n"
"background-color: #636363;\n"
"}")
self.gobtn.setObjectName("gobtn")
self.boxname = Entrybox(self.centralwidget)
self.boxname.setGeometry(QtCore.QRect(10, 110, 380, 31))
font = QtGui.QFont()
font.setFamily("Microsoft YaHei")
font.setPointSize(12)
self.boxname.setFont(font)
self.boxname.setStyleSheet("Entrybox {\n"
"background-color: #595959;\n"
"border:0px;\n"
"color:#ffffff;\n"
"selection-color: #ffffff;\n"
"selection-background-color: #484848;\n"
"border-radius: 15px;\n"
"}\n"
"Entrybox:hover {\n"
"background-color: #636363;\n"
"}\n"
"Entrybox:focus {\n"
"background-color: #636363;\n"
"}")
self.boxname.setAlignment(QtCore.Qt.AlignCenter)
self.boxname.setObjectName("boxname")
self.status = QtWidgets.QLabel(self.centralwidget)
self.status.setGeometry(QtCore.QRect(0, 210, 400, 31))
font = QtGui.QFont()
font.setFamily("Microsoft YaHei")
font.setPointSize(15)
self.status.setFont(font)
self.status.setStyleSheet("color:#fff;")
self.status.setAlignment(QtCore.Qt.AlignCenter)
self.status.setObjectName("status")
self.titlelabel = QtWidgets.QLabel(self.centralwidget)
self.titlelabel.setGeometry(QtCore.QRect(10, 250, 36, 31))
font = QtGui.QFont()
font.setFamily("Microsoft YaHei")
font.setPointSize(12)
self.titlelabel.setFont(font)
self.titlelabel.setStyleSheet("color:#fff;")
self.titlelabel.setObjectName("titlelabel")
self.boxtitle = Entrybox(self.centralwidget)
self.boxtitle.setGeometry(QtCore.QRect(55, 250, 336, 31))
font = QtGui.QFont()
font.setFamily("Microsoft YaHei")
font.setPointSize(12)
self.boxtitle.setFont(font)
self.boxtitle.setStyleSheet("Entrybox {\n"
"background-color: #595959;\n"
"border:0px;\n"
"color:#ffffff;\n"
"selection-color: #ffffff;\n"
"selection-background-color: #484848;\n"
"border-radius: 15px;\n"
"}\n"
"Entrybox:hover {\n"
"background-color: #636363;\n"
"}\n"
"Entrybox:focus {\n"
"background-color: #636363;\n"
"}")
self.boxtitle.setAlignment(QtCore.Qt.AlignCenter)
self.boxtitle.setObjectName("boxtitle")
self.urllabel = QtWidgets.QLabel(self.centralwidget)
self.urllabel.setGeometry(QtCore.QRect(10, 300, 99, 31))
font = QtGui.QFont()
font.setFamily("Microsoft YaHei")
font.setPointSize(12)
self.urllabel.setFont(font)
self.urllabel.setStyleSheet("color:#fff;")
self.urllabel.setObjectName("urllabel")
self.boxshorturl = Entrybox(self.centralwidget)
self.boxshorturl.setGeometry(QtCore.QRect(115, 300, 277, 31))
font = QtGui.QFont()
font.setFamily("Microsoft YaHei")
font.setPointSize(12)
self.boxshorturl.setFont(font)
self.boxshorturl.setStyleSheet("Entrybox {\n"
"background-color: #595959;\n"
"border:0px;\n"
"color:#ffffff;\n"
"selection-color: #ffffff;\n"
"selection-background-color: #484848;\n"
"border-radius: 15px;\n"
"}\n"
"Entrybox:hover {\n"
"background-color: #636363;\n"
"}\n"
"Entrybox:focus {\n"
"background-color: #636363;\n"
"}")
self.boxshorturl.setAlignment(QtCore.Qt.AlignCenter)
self.boxshorturl.setObjectName("boxshorturl")
self.copybtn = QtWidgets.QPushButton(self.centralwidget)
self.copybtn.setGeometry(QtCore.QRect(160, 340, 81, 41))
font = QtGui.QFont()
font.setFamily("Microsoft YaHei")
font.setPointSize(15)
font.setBold(True)
font.setWeight(75)
self.copybtn.setFont(font)
self.copybtn.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.copybtn.setStyleSheet("QPushButton {\n"
"background-color: #505050;\n"
"border:0px;\n"
"color:#ffffff;\n"
"border-radius:15px;\n"
"}\n"
"QPushButton:hover {\n"
"background-color: #595959;\n"
"}\n"
"QPushButton:pressed {\n"
"background-color: #636363;\n"
"}")
self.copybtn.setObjectName("copybtn")
window.setFocus()
window.setCentralWidget(self.centralwidget)
self.retranslateUi(window)
self.UiSetup()
QtCore.QMetaObject.connectSlotsByName(window)
def retranslateUi(self, window):
_translate = QtCore.QCoreApplication.translate
window.setWindowTitle(_translate("window", "URL Shortener Online"))
self.label.setText(_translate("window", "URL Shortener Online"))
self.gobtn.setText(_translate("window", "Go"))
self.status.setText(_translate("window", ""))
self.titlelabel.setText(_translate("window", "Title:"))
self.urllabel.setText(_translate("window", "Shorten URL:"))
self.copybtn.setText(_translate("window", "Copy"))
def UiSetup(self):
add_hotkey('ctrl + c', self.copylink)
self.boxurl.setPlaceholderText('Enter Long URL')
self.boxname.setPlaceholderText('Enter Alias/Name (Optional)')
self.gobtn.clicked.connect(self.shortenit)
self.copybtn.clicked.connect(self.copylink)
self.titlelabel.setHidden(True)
self.boxtitle.setHidden(True)
self.urllabel.setHidden(True)
self.boxshorturl.setHidden(True)
self.copybtn.setHidden(True)
def showwarning(self,message,title='Error') -> str:
msg = QMessageBox()
msg.setIcon(QMessageBox.Critical)
msg.setText(message)
msg.setWindowTitle(title)
msg.exec_()
def shortenit(self):
url=self.boxurl.text()
if 'http' not in url:
url='http://'+url
name=self.boxname.text()
if name=='':
api_url=f"https://cutt.ly/api/api.php?key=667cc3506cc77adad0b8503f2dfc8a2121930&short={url}"
else:
api_url=f'https://cutt.ly/api/api.php?key=667cc3506cc77adad0b8503f2dfc8a2121930&short={url}&name={name}'
try:
link=get(api_url).json()['url']
except:
self.showwarning('Please check your Internet Connection')
return
self.linkstatus=link['status']
if self.linkstatus==7:
self.status.setText('Done!')
pass
elif self.linkstatus==3:
self.showwarning('Alias/Name is already taken')
return
elif self.linkstatus==2:
self.showwarning('URL is Invalid or not supported')
return
elif self.linkstatus==5:
self.showwarning('Entered Alias/Name in not supported')
return
else:
self.showwarning('Something went wrong!')
return
self.shortlink=link['shortLink']
self.title=link['title']
self.titlelabel.setHidden(False)
self.boxtitle.setHidden(False)
self.urllabel.setHidden(False)
self.boxshorturl.setHidden(False)
self.copybtn.setHidden(False)
self.win.setFixedSize(400,400)
self.boxtitle.setText(self.title)
self.boxshorturl.setText(self.shortlink)
def copylink(self):
try:
copy(self.shortlink)
except:
pass
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QMainWindow()
ui = Ui_window()
ui.setupUi(window)
window.show()
sys.exit(app.exec_())

Why I don't get error and application doesn't open

Why Android Studio doesn't detect error but when I try to open the app on mobile device it doesn't open.
It only opens if I comment these 2 lines in the Activity but of course I don't get full functionality. Am I missing something?
Commented lines
spinner.findViewById(R.id.spinnerCountries);
spinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item,CountryData.countryNames));
*Activity.java
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Spinner;
import com.google.firebase.FirebaseException;
import com.google.firebase.auth.FirebaseAuth;
public class RegisterActivity extends AppCompatActivity {
private Spinner spinner;
private EditText editText;
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
spinner.findViewById(R.id.spinnerCountries);
spinner.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_spinner_dropdown_item,CountryData.countryNames));
editText = findViewById(R.id.editTextPhone);
findViewById(R.id.buttonContinue).setOnClickListener(new View.OnClickListener() {
#Override
public void onClick(View v) {
String code = CountryData.countryAreaCodes[spinner.getSelectedItemPosition()];
String number = editText.getText().toString().trim();
if (number.isEmpty() || number.length() < 10){
editText.setError("Valid number is required");
editText.requestFocus();
return;
}
String phonenumber = "+" + code + number;
Intent intent = new Intent (RegisterActivity.this,OtpActivity.class);
intent.putExtra("phonenumber",phonenumber);
startActivity(intent);
}
});
}
#Override
protected void onStart() {
super.onStart();
if (FirebaseAuth.getInstance().getCurrentUser() !=null) {
Intent intent = new Intent (this, MainActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);
}
}
}
This is the file which I am trying to connect to the Activity
CountryData.java
public class CountryData {
public static final String[] countryNames =
{"Afghanistan", "Albania",
"Algeria", "Andorra", "Angola", "Antarctica", "Argentina",
"Armenia", "Aruba", "Australia", "Austria", "Azerbaijan",
"Bahrain", "Bangladesh", "Belarus", "Belgium", "Belize", "Benin",
"Bhutan", "Bolivia", "Bosnia And Herzegovina", "Botswana",
"Brazil", "Brunei Darussalam", "Bulgaria", "Burkina Faso",
"Myanmar", "Burundi", "Cambodia", "Cameroon", "Canada",
"Cape Verde", "Central African Republic", "Chad", "Chile", "China",
"Christmas Island", "Cocos (keeling) Islands", "Colombia",
"Comoros", "Congo", "Cook Islands", "Costa Rica", "Croatia",
"Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti",
"Timor-leste", "Ecuador", "Egypt", "El Salvador",
"Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia",
"Falkland Islands (malvinas)", "Faroe Islands", "Fiji", "Finland",
"France", "French Polynesia", "Gabon", "Gambia", "Georgia",
"Germany", "Ghana", "Gibraltar", "Greece", "Greenland",
"Guatemala", "Guinea", "Guinea-bissau", "Guyana", "Haiti",
"Honduras", "Hong Kong", "Hungary", "India", "Indonesia", "Iran",
"Iraq", "Ireland", "Isle Of Man", "Israel", "Italy", "Ivory Coast",
"Jamaica", "Japan", "Jordan", "Kazakhstan", "Kenya", "Kiribati",
"Kuwait", "Kyrgyzstan", "Laos", "Latvia", "Lebanon", "Lesotho",
"Liberia", "Libya", "Liechtenstein", "Lithuania", "Luxembourg",
"Macao", "Macedonia", "Madagascar", "Malawi", "Malaysia",
"Maldives", "Mali", "Malta", "Marshall Islands", "Mauritania",
"Mauritius", "Mayotte", "Mexico", "Micronesia", "Moldova",
"Monaco", "Mongolia", "Montenegro", "Morocco", "Mozambique",
"Namibia", "Nauru", "Nepal", "Netherlands", "New Caledonia",
"New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Korea",
"Norway", "Oman", "Pakistan", "Palau", "Panama",
"Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn",
"Poland", "Portugal", "Puerto Rico", "Qatar", "Romania",
"Russian Federation", "Rwanda", "Saint Barthélemy", "Samoa",
"San Marino", "Sao Tome And Principe", "Saudi Arabia", "Senegal",
"Serbia", "Seychelles", "Sierra Leone", "Singapore", "Slovakia",
"Slovenia", "Solomon Islands", "Somalia", "South Africa",
"Korea, Republic Of", "Spain", "Sri Lanka", "Saint Helena",
"Saint Pierre And Miquelon", "Sudan", "Suriname", "Swaziland",
"Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan",
"Tajikistan", "Tanzania", "Thailand", "Togo", "Tokelau", "Tonga",
"Tunisia", "Turkey", "Turkmenistan", "Tuvalu",
"United Arab Emirates", "Uganda", "United Kingdom", "Ukraine",
"Uruguay", "United States", "Uzbekistan", "Vanuatu",
"Holy See (vatican City State)", "Venezuela", "Viet Nam",
"Wallis And Futuna", "Yemen", "Zambia", "Zimbabwe"};
public static final String[] countryAreaCodes = {"93", "355", "213",
"376", "244", "672", "54", "374", "297", "61", "43", "994", "973",
"880", "375", "32", "501", "229", "975", "591", "387", "267", "55",
"673", "359", "226", "95", "257", "855", "237", "1", "238", "236",
"235", "56", "86", "61", "61", "57", "269", "242", "682", "506",
"385", "53", "357", "420", "45", "253", "670", "593", "20", "503",
"240", "291", "372", "251", "500", "298", "679", "358", "33",
"689", "241", "220", "995", "49", "233", "350", "30", "299", "502",
"224", "245", "592", "509", "504", "852", "36", "91", "62", "98",
"964", "353", "44", "972", "39", "225", "1876", "81", "962", "7",
"254", "686", "965", "996", "856", "371", "961", "266", "231",
"218", "423", "370", "352", "853", "389", "261", "265", "60",
"960", "223", "356", "692", "222", "230", "262", "52", "691",
"373", "377", "976", "382", "212", "258", "264", "674", "977",
"31", "687", "64", "505", "227", "234", "683", "850", "47", "968",
"92", "680", "507", "675", "595", "51", "63", "870", "48", "351",
"1", "974", "40", "7", "250", "590", "685", "378", "239", "966",
"221", "381", "248", "232", "65", "421", "386", "677", "252", "27",
"82", "34", "94", "290", "508", "249", "597", "268", "46", "41",
"963", "886", "992", "255", "66", "228", "690", "676", "216", "90",
"993", "688", "971", "256", "44", "380", "598", "1", "998", "678",
"39", "58", "84", "681", "967", "260", "263"};
}

Stateful Retry Advice does not resubmit message

We are using Spring Integration + JMS + ActiveMQ to exchange messages between microservices using Virtual Topics.
Here is our configuration for the inbound messages:
#Autowired
lateinit var connectionFactory: ConnectionFactory
#Autowired
lateinit var messageConverter: MessageConverter
#Bean("file-uploaded.inbound")
fun inboundChannel() = MessageChannels.queue().get()
#Bean("file-uploaded.inbound.flow")
fun inboundFlow(): IntegrationFlow {
return IntegrationFlows.from(
Jms.messageDrivenChannelAdapter(
Jms.container(connectionFactory,
"Consumer.appId.VirtualTopic.file-uploaded")
.pubSubDomain(false).get()
).jmsMessageConverter(messageConverter)
).channel(inboundChannel()).get()
}
and here is our retry advice (fairly default, except for the retry state generator):
#Bean
fun requestHandlerRetryAdvice(): RequestHandlerRetryAdvice {
return RequestHandlerRetryAdvice().apply {
setRetryStateGenerator(SpelExpressionRetryStateGenerator("headers[\"jms_messageId\"]"))
setRecoveryCallback(ErrorMessageSendingRecoverer())
}
}
and message handler:
#MessageEndpoint
class FileUploadedEventListener() {
#ServiceActivator(inputChannel = "file-uploaded.inbound", adviceChain = ["requestHandlerRetryAdvice"])
fun handleFileUploadedEvent(fileUploadedEvent: FileUploadedEvent) {
LoggerFactory.getLogger(this.javaClass.name).info("Received event: $fileUploadedEvent")
throw RuntimeException()
}
}
Basically the reply advice is not putting the message back on the queue as it is supposed to (as per documentation) and it is sending an error message on the 'errorChannel' after the first try.
Has anyone experienced the same problem using Virtual Topics?
Or are we just missing something in the configuration?
Thanks!
Update here below the debug logging:
2018-09-19 15:40:07.877 DEBUG .i.j.ChannelPublishingJmsMessageListener : converted JMS Message [ActiveMQBytesMessage {commandId = 5, responseRequired = true, messageId = ID:Marcos-MBP.intranet-57777-1537280015474-1:71:1:1:1, originalDestination = topic://VirtualTopic.file-uploaded, originalTransactionId = null, producerId = ID:Marcos-MBP.intranet-57777-1537280015474-1:71:1:1, destination = queue://Consumer.dev-platform-asset-previews.VirtualTopic.file-uploaded, transactionId = null, expiration = 0, timestamp = 1537368007815, arrival = 0, brokerInTime = 1537368007821, brokerOutTime = 1537368007822, correlationId = null, replyTo = null, persistent = true, type = null, priority = 4, groupID = null, groupSequence = 0, targetConsumerId = null, compressed = false, userID = null, content = org.apache.activemq.util.ByteSequence#732fdf26, marshalledProperties = org.apache.activemq.util.ByteSequence#6ca08492, dataStructure = null, redeliveryCounter = 0, size = 0, properties = {spanTraceId=4770babc94e7d760, spanId=0c31247dd4ed71eb, spanParentSpanId=4770babc94e7d760, _type=FileUploadedEvent, spanSampled=0}, readOnlyProperties = true, readOnlyBody = true, droppable = false, jmsXGroupFirstForConsumer = false} ActiveMQBytesMessage{ bytesOut = null, dataOut = null, dataIn = java.io.DataInputStream#33c0baa3 }] to integration Message payload [FileUploadedEvent(assetId=c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, objectKey=account-id/c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, bucketName=platform-asset-storage-dev, accountId=account-id, fileName=unknown, userId=1)]
2018-09-19 15:40:07.879 DEBUG o.s.integration.channel.DirectChannel : preSend on channel 'file-uploaded.inbound.flow.channel#0', message: GenericMessage [payload=FileUploadedEvent(assetId=c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, objectKey=account-id/c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, bucketName=platform-asset-storage-dev, accountId=account-id, fileName=unknown, userId=1), headers={spanTraceId=4770babc94e7d760, spanId=0c31247dd4ed71eb, spanParentSpanId=4770babc94e7d760, jms_redelivered=false, jms_destination=queue://Consumer.dev-platform-asset-previews.VirtualTopic.file-uploaded, _type=FileUploadedEvent, id=266d356e-dc90-cb33-8818-40a3cf718125, priority=4, spanSampled=0, jms_timestamp=1537368007815, jms_messageId=ID:Marcos-MBP.intranet-57777-1537280015474-1:71:1:1:1, timestamp=1537368007879}]
2018-09-19 15:40:07.882 DEBUG o.s.integration.handler.BridgeHandler : file-uploaded.inbound.flow.org.springframework.integration.handler.BridgeHandler#0 received message: GenericMessage [payload=FileUploadedEvent(assetId=c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, objectKey=account-id/c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, bucketName=platform-asset-storage-dev, accountId=account-id, fileName=unknown, userId=1), headers={jms_destination=queue://Consumer.dev-platform-asset-previews.VirtualTopic.file-uploaded, _type=FileUploadedEvent, X-B3-ParentSpanId=0c31247dd4ed71eb, priority=4, jms_timestamp=1537368007815, spanTraceId=4770babc94e7d760, spanId=04c0bd5a812ee159, spanParentSpanId=0c31247dd4ed71eb, nativeHeaders={spanTraceId=[4770babc94e7d760], spanId=[04c0bd5a812ee159], spanParentSpanId=[0c31247dd4ed71eb], spanSampled=[0]}, jms_redelivered=false, X-B3-SpanId=04c0bd5a812ee159, X-B3-Sampled=0, X-B3-TraceId=4770babc94e7d760, id=33d89f7b-dbf8-b381-add7-549d875dd914, spanSampled=0, jms_messageId=ID:Marcos-MBP.intranet-57777-1537280015474-1:71:1:1:1, timestamp=1537368007881}]
2018-09-19 15:40:07.883 DEBUG o.s.integration.channel.QueueChannel : preSend on channel 'file-uploaded.inbound', message: GenericMessage [payload=FileUploadedEvent(assetId=c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, objectKey=account-id/c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, bucketName=platform-asset-storage-dev, accountId=account-id, fileName=unknown, userId=1), headers={jms_destination=queue://Consumer.dev-platform-asset-previews.VirtualTopic.file-uploaded, _type=FileUploadedEvent, X-B3-ParentSpanId=0c31247dd4ed71eb, priority=4, jms_timestamp=1537368007815, spanTraceId=4770babc94e7d760, spanId=04c0bd5a812ee159, spanParentSpanId=0c31247dd4ed71eb, nativeHeaders={spanTraceId=[4770babc94e7d760], spanId=[04c0bd5a812ee159], spanParentSpanId=[0c31247dd4ed71eb], spanSampled=[0]}, jms_redelivered=false, X-B3-SpanId=04c0bd5a812ee159, X-B3-Sampled=0, X-B3-TraceId=4770babc94e7d760, id=33d89f7b-dbf8-b381-add7-549d875dd914, spanSampled=0, jms_messageId=ID:Marcos-MBP.intranet-57777-1537280015474-1:71:1:1:1, timestamp=1537368007881}]
2018-09-19 15:40:07.884 DEBUG o.s.integration.channel.QueueChannel : postSend (sent=true) on channel 'file-uploaded.inbound', message: GenericMessage [payload=FileUploadedEvent(assetId=c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, objectKey=account-id/c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, bucketName=platform-asset-storage-dev, accountId=account-id, fileName=unknown, userId=1), headers={jms_destination=queue://Consumer.dev-platform-asset-previews.VirtualTopic.file-uploaded, _type=FileUploadedEvent, X-B3-ParentSpanId=04c0bd5a812ee159, priority=4, jms_timestamp=1537368007815, spanTraceId=4770babc94e7d760, spanId=49b4d98b393a623e, spanParentSpanId=04c0bd5a812ee159, nativeHeaders={spanTraceId=[4770babc94e7d760], spanId=[49b4d98b393a623e], spanParentSpanId=[04c0bd5a812ee159], spanSampled=[0], X-B3-TraceId=[4770babc94e7d760], X-B3-SpanId=[49b4d98b393a623e], X-B3-ParentSpanId=[04c0bd5a812ee159], X-B3-Sampled=[0]}, jms_redelivered=false, X-B3-SpanId=49b4d98b393a623e, X-B3-Sampled=0, X-B3-TraceId=4770babc94e7d760, id=70e86708-b383-ce4a-61f5-36a69ecadfeb, spanSampled=0, jms_messageId=ID:Marcos-MBP.intranet-57777-1537280015474-1:71:1:1:1, timestamp=1537368007883}]
2018-09-19 15:40:07.884 DEBUG o.s.integration.channel.QueueChannel : postReceive on channel 'file-uploaded.inbound', message: GenericMessage [payload=FileUploadedEvent(assetId=c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, objectKey=account-id/c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, bucketName=platform-asset-storage-dev, accountId=account-id, fileName=unknown, userId=1), headers={jms_destination=queue://Consumer.dev-platform-asset-previews.VirtualTopic.file-uploaded, _type=FileUploadedEvent, X-B3-ParentSpanId=04c0bd5a812ee159, priority=4, jms_timestamp=1537368007815, spanTraceId=4770babc94e7d760, spanId=49b4d98b393a623e, spanParentSpanId=04c0bd5a812ee159, nativeHeaders={spanTraceId=[4770babc94e7d760], spanId=[49b4d98b393a623e], spanParentSpanId=[04c0bd5a812ee159], spanSampled=[0], X-B3-TraceId=[4770babc94e7d760], X-B3-SpanId=[49b4d98b393a623e], X-B3-ParentSpanId=[04c0bd5a812ee159], X-B3-Sampled=[0]}, jms_redelivered=false, X-B3-SpanId=49b4d98b393a623e, X-B3-Sampled=0, X-B3-TraceId=4770babc94e7d760, id=70e86708-b383-ce4a-61f5-36a69ecadfeb, spanSampled=0, jms_messageId=ID:Marcos-MBP.intranet-57777-1537280015474-1:71:1:1:1, timestamp=1537368007883}]
2018-09-19 15:40:07.884 DEBUG o.s.i.handler.ServiceActivatingHandler : ServiceActivator for [org.springframework.integration.handler.MethodInvokingMessageProcessor#62a15309] (fileUploadedEventListener.handleFileUploadedEvent.serviceActivator.handler) received message: GenericMessage [payload=FileUploadedEvent(assetId=c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, objectKey=account-id/c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, bucketName=platform-asset-storage-dev, accountId=account-id, fileName=unknown, userId=1), headers={jms_destination=queue://Consumer.dev-platform-asset-previews.VirtualTopic.file-uploaded, _type=FileUploadedEvent, priority=4, jms_timestamp=1537368007815, spanTraceId=4770babc94e7d760, spanId=7f9b16d7f7d5b347, spanParentSpanId=49b4d98b393a623e, nativeHeaders={spanTraceId=[4770babc94e7d760], spanId=[7f9b16d7f7d5b347], spanParentSpanId=[49b4d98b393a623e], spanSampled=[0]}, jms_redelivered=false, id=4c6d131e-448e-9863-f84b-7a4a8e563b09, spanSampled=0, jms_messageId=ID:Marcos-MBP.intranet-57777-1537280015474-1:71:1:1:1}]
2018-09-19 15:40:07.884 DEBUG o.s.integration.channel.DirectChannel : postSend (sent=true) on channel 'file-uploaded.inbound.flow.channel#0', message: GenericMessage [payload=FileUploadedEvent(assetId=c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, objectKey=account-id/c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, bucketName=platform-asset-storage-dev, accountId=account-id, fileName=unknown, userId=1), headers={jms_destination=queue://Consumer.dev-platform-asset-previews.VirtualTopic.file-uploaded, _type=FileUploadedEvent, X-B3-ParentSpanId=0c31247dd4ed71eb, priority=4, jms_timestamp=1537368007815, spanTraceId=4770babc94e7d760, spanId=04c0bd5a812ee159, spanParentSpanId=0c31247dd4ed71eb, nativeHeaders={spanTraceId=[4770babc94e7d760], spanId=[7f9b16d7f7d5b347], spanParentSpanId=[49b4d98b393a623e], spanSampled=[0]}, jms_redelivered=false, X-B3-SpanId=04c0bd5a812ee159, X-B3-Sampled=0, X-B3-TraceId=4770babc94e7d760, id=33d89f7b-dbf8-b381-add7-549d875dd914, spanSampled=0, jms_messageId=ID:Marcos-MBP.intranet-57777-1537280015474-1:71:1:1:1, timestamp=1537368007881}]
2018-09-19 15:40:07.888 DEBUG o.s.retry.support.RetryTemplate : Retry: count=0
2018-09-19 15:40:07.901 INFO c.b.p.a.a.e.FileUploadedEventListener : Received file uploaded event GenericMessage [payload=FileUploadedEvent(assetId=c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, objectKey=account-id/c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, bucketName=platform-asset-storage-dev, accountId=account-id, fileName=unknown, userId=1), headers={jms_destination=queue://Consumer.dev-platform-asset-previews.VirtualTopic.file-uploaded, _type=FileUploadedEvent, priority=4, jms_timestamp=1537368007815, spanTraceId=4770babc94e7d760, spanId=7f9b16d7f7d5b347, spanParentSpanId=49b4d98b393a623e, nativeHeaders={spanTraceId=[4770babc94e7d760], spanId=[7f9b16d7f7d5b347], spanParentSpanId=[49b4d98b393a623e], spanSampled=[0]}, jms_redelivered=false, id=4c6d131e-448e-9863-f84b-7a4a8e563b09, spanSampled=0, jms_messageId=ID:Marcos-MBP.intranet-57777-1537280015474-1:71:1:1:1}]
2018-09-19 15:40:07.902 DEBUG o.s.retry.support.RetryTemplate : Checking for rethrow: count=1
2018-09-19 15:40:07.902 DEBUG o.s.retry.support.RetryTemplate : Rethrow in retry for policy: count=1
2018-09-19 15:40:07.904 DEBUG o.s.i.channel.PublishSubscribeChannel : preSend on channel 'errorChannel', message: ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: nested exception is java.lang.RuntimeException, failedMessage=GenericMessage [payload=FileUploadedEvent(assetId=c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, objectKey=account-id/c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, bucketName=platform-asset-storage-dev, accountId=account-id, fileName=unknown, userId=1), headers={jms_destination=queue://Consumer.dev-platform-asset-previews.VirtualTopic.file-uploaded, _type=FileUploadedEvent, priority=4, jms_timestamp=1537368007815, spanTraceId=4770babc94e7d760, spanId=7f9b16d7f7d5b347, spanParentSpanId=49b4d98b393a623e, nativeHeaders={spanTraceId=[4770babc94e7d760], spanId=[7f9b16d7f7d5b347], spanParentSpanId=[49b4d98b393a623e], spanSampled=[0]}, jms_redelivered=false, id=4c6d131e-448e-9863-f84b-7a4a8e563b09, spanSampled=0, jms_messageId=ID:Marcos-MBP.intranet-57777-1537280015474-1:71:1:1:1}], headers={id=631dd6f9-0e84-15c7-c953-48d732c25270, timestamp=1537368007904}] for original GenericMessage [payload=FileUploadedEvent(assetId=c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, objectKey=account-id/c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, bucketName=platform-asset-storage-dev, accountId=account-id, fileName=unknown, userId=1), headers={jms_destination=queue://Consumer.dev-platform-asset-previews.VirtualTopic.file-uploaded, _type=FileUploadedEvent, X-B3-ParentSpanId=49b4d98b393a623e, priority=4, jms_timestamp=1537368007815, spanTraceId=4770babc94e7d760, spanId=7f9b16d7f7d5b347, spanParentSpanId=49b4d98b393a623e, nativeHeaders={spanTraceId=[4770babc94e7d760], spanId=[7f9b16d7f7d5b347], spanParentSpanId=[49b4d98b393a623e], spanSampled=[0]}, jms_redelivered=false, X-B3-SpanId=7f9b16d7f7d5b347, X-B3-Sampled=0, X-B3-TraceId=4770babc94e7d760, id=88313bfb-a45d-c9ff-268f-5c2f50e03156, spanSampled=0, jms_messageId=ID:Marcos-MBP.intranet-57777-1537280015474-1:71:1:1:1}]
2018-09-19 15:40:07.904 DEBUG o.s.i.handler.ServiceActivatingHandler : ServiceActivator for [org.springframework.integration.handler.MethodInvokingMessageProcessor#484a98b8] (fileUploadedEventListener.handleError.serviceActivator.handler) received message: ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: nested exception is java.lang.RuntimeException, failedMessage=GenericMessage [payload=FileUploadedEvent(assetId=c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, objectKey=account-id/c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, bucketName=platform-asset-storage-dev, accountId=account-id, fileName=unknown, userId=1), headers={jms_destination=queue://Consumer.dev-platform-asset-previews.VirtualTopic.file-uploaded, _type=FileUploadedEvent, priority=4, jms_timestamp=1537368007815, spanTraceId=4770babc94e7d760, spanId=7f9b16d7f7d5b347, spanParentSpanId=49b4d98b393a623e, nativeHeaders={spanTraceId=[4770babc94e7d760], spanId=[b72c67f61de7c366], spanParentSpanId=[7f9b16d7f7d5b347], spanSampled=[0], X-B3-TraceId=[4770babc94e7d760], X-B3-SpanId=[b72c67f61de7c366], X-B3-ParentSpanId=[7f9b16d7f7d5b347], X-B3-Sampled=[0]}, jms_redelivered=false, id=4c6d131e-448e-9863-f84b-7a4a8e563b09, spanSampled=0, jms_messageId=ID:Marcos-MBP.intranet-57777-1537280015474-1:71:1:1:1}], headers={X-B3-ParentSpanId=7f9b16d7f7d5b347, X-B3-Sampled=0, X-B3-TraceId=4770babc94e7d760, id=69a058ce-deed-f3e2-eb20-d4e874171ba6, X-B3-SpanId=b72c67f61de7c366, timestamp=1537368007904}]
2018-09-19 15:40:07.905 DEBUG o.s.i.handler.ServiceActivatingHandler : handler 'ServiceActivator for [org.springframework.integration.handler.MethodInvokingMessageProcessor#484a98b8] (fileUploadedEventListener.handleError.serviceActivator.handler)' produced no reply for request Message: ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: nested exception is java.lang.RuntimeException, failedMessage=GenericMessage [payload=FileUploadedEvent(assetId=c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, objectKey=account-id/c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, bucketName=platform-asset-storage-dev, accountId=account-id, fileName=unknown, userId=1), headers={jms_destination=queue://Consumer.dev-platform-asset-previews.VirtualTopic.file-uploaded, _type=FileUploadedEvent, priority=4, jms_timestamp=1537368007815, spanTraceId=4770babc94e7d760, spanId=7f9b16d7f7d5b347, spanParentSpanId=49b4d98b393a623e, nativeHeaders={spanTraceId=[4770babc94e7d760], spanId=[b72c67f61de7c366], spanParentSpanId=[7f9b16d7f7d5b347], spanSampled=[0], X-B3-TraceId=[4770babc94e7d760], X-B3-SpanId=[b72c67f61de7c366], X-B3-ParentSpanId=[7f9b16d7f7d5b347], X-B3-Sampled=[0]}, jms_redelivered=false, id=4c6d131e-448e-9863-f84b-7a4a8e563b09, spanSampled=0, jms_messageId=ID:Marcos-MBP.intranet-57777-1537280015474-1:71:1:1:1}], headers={X-B3-ParentSpanId=7f9b16d7f7d5b347, X-B3-Sampled=0, X-B3-TraceId=4770babc94e7d760, id=69a058ce-deed-f3e2-eb20-d4e874171ba6, X-B3-SpanId=b72c67f61de7c366, timestamp=1537368007904}]
2018-09-19 15:40:07.905 DEBUG o.s.integration.handler.LoggingHandler : _org.springframework.integration.errorLogger.handler received message: ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: nested exception is java.lang.RuntimeException, failedMessage=GenericMessage [payload=FileUploadedEvent(assetId=c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, objectKey=account-id/c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, bucketName=platform-asset-storage-dev, accountId=account-id, fileName=unknown, userId=1), headers={jms_destination=queue://Consumer.dev-platform-asset-previews.VirtualTopic.file-uploaded, _type=FileUploadedEvent, priority=4, jms_timestamp=1537368007815, spanTraceId=4770babc94e7d760, spanId=7f9b16d7f7d5b347, spanParentSpanId=49b4d98b393a623e, nativeHeaders={spanTraceId=[4770babc94e7d760], spanId=[b72c67f61de7c366], spanParentSpanId=[7f9b16d7f7d5b347], spanSampled=[0], X-B3-TraceId=[4770babc94e7d760], X-B3-SpanId=[b72c67f61de7c366], X-B3-ParentSpanId=[7f9b16d7f7d5b347], X-B3-Sampled=[0]}, jms_redelivered=false, id=4c6d131e-448e-9863-f84b-7a4a8e563b09, spanSampled=0, jms_messageId=ID:Marcos-MBP.intranet-57777-1537280015474-1:71:1:1:1}], headers={X-B3-ParentSpanId=7f9b16d7f7d5b347, X-B3-Sampled=0, X-B3-TraceId=4770babc94e7d760, id=69a058ce-deed-f3e2-eb20-d4e874171ba6, X-B3-SpanId=b72c67f61de7c366, timestamp=1537368007904}]
2018-09-19 15:40:07.906 ERROR o.s.integration.handler.LoggingHandler : org.springframework.messaging.MessageHandlingException: nested exception is java.lang.RuntimeException, failedMessage=GenericMessage [payload=FileUploadedEvent(assetId=c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, objectKey=account-id/c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, bucketName=platform-asset-storage-dev, accountId=account-id, fileName=unknown, userId=1), headers={jms_destination=queue://Consumer.dev-platform-asset-previews.VirtualTopic.file-uploaded, _type=FileUploadedEvent, priority=4, jms_timestamp=1537368007815, spanTraceId=4770babc94e7d760, spanId=7f9b16d7f7d5b347, spanParentSpanId=49b4d98b393a623e, nativeHeaders={spanTraceId=[4770babc94e7d760], spanId=[b72c67f61de7c366], spanParentSpanId=[7f9b16d7f7d5b347], spanSampled=[0], X-B3-TraceId=[4770babc94e7d760], X-B3-SpanId=[b72c67f61de7c366], X-B3-ParentSpanId=[7f9b16d7f7d5b347], X-B3-Sampled=[0]}, jms_redelivered=false, id=4c6d131e-448e-9863-f84b-7a4a8e563b09, spanSampled=0, jms_messageId=ID:Marcos-MBP.intranet-57777-1537280015474-1:71:1:1:1}]
at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:107)
at org.springframework.integration.handler.ServiceActivatingHandler.handleRequestMessage(ServiceActivatingHandler.java:93)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler$AdvisedRequestHandler.handleRequestMessage(AbstractReplyProducingMessageHandler.java:182)
[...]
Caused by: java.lang.RuntimeException
at FileUploadedEventListener.handleFileUploadedEvent(FileUploadedEventListener.kt:35)
at FileUploadedEventListener$$FastClassBySpringCGLIB$$eb75a593.invoke(<generated>)
[...]
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:181)
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:114)
at org.springframework.integration.util.MessagingMethodInvokerHelper$HandlerMethod.invoke(MessagingMethodInvokerHelper.java:1056)
at org.springframework.integration.util.MessagingMethodInvokerHelper.invokeHandlerMethod(MessagingMethodInvokerHelper.java:574)
at org.springframework.integration.util.MessagingMethodInvokerHelper.processInternal(MessagingMethodInvokerHelper.java:468)
at org.springframework.integration.util.MessagingMethodInvokerHelper.process(MessagingMethodInvokerHelper.java:312)
at org.springframework.integration.handler.MethodInvokingMessageProcessor.processMessage(MethodInvokingMessageProcessor.java:104)
... 29 more
2018-09-19 15:40:07.907 DEBUG o.s.i.channel.PublishSubscribeChannel : postSend (sent=true) on channel 'errorChannel', message: ErrorMessage [payload=org.springframework.messaging.MessageHandlingException: nested exception is java.lang.RuntimeException, failedMessage=GenericMessage [payload=FileUploadedEvent(assetId=c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, objectKey=account-id/c9c73263-e05c-4cb0-bf7b-ea2d3b934c13, bucketName=platform-asset-storage-dev, accountId=account-id, fileName=unknown, userId=1), headers={jms_destination=queue://Consumer.dev-platform-asset-previews.VirtualTopic.file-uploaded, _type=FileUploadedEvent, priority=4, jms_timestamp=1537368007815, spanTraceId=4770babc94e7d760, spanId=7f9b16d7f7d5b347, spanParentSpanId=49b4d98b393a623e, nativeHeaders={spanTraceId=[4770babc94e7d760], spanId=[b72c67f61de7c366], spanParentSpanId=[7f9b16d7f7d5b347], spanSampled=[0], X-B3-TraceId=[4770babc94e7d760], X-B3-SpanId=[b72c67f61de7c366], X-B3-ParentSpanId=[7f9b16d7f7d5b347], X-B3-Sampled=[0]}, jms_redelivered=false, id=4c6d131e-448e-9863-f84b-7a4a8e563b09, spanSampled=0, jms_messageId=ID:Marcos-MBP.intranet-57777-1537280015474-1:71:1:1:1}], headers={X-B3-ParentSpanId=7f9b16d7f7d5b347, X-B3-Sampled=0, X-B3-TraceId=4770babc94e7d760, id=69a058ce-deed-f3e2-eb20-d4e874171ba6, X-B3-SpanId=b72c67f61de7c366, timestamp=1537368007904}]
fun inboundChannel() = MessageChannels.queue().get()
It's because you are using a QueueChannel - you need DirectChannel if you want the exception to be thrown back to inbound channel adapter so the message will be requeued.
With a queue channel, the poller will simply send the exception to the error channel.

RMS error, AME, correlation from text files and exporting summery statistics in excel in matlab

Dear Experts;
I am trying to make a code which able to calculate RMS, AME, correlation of 24 text files with name output_00.txt to ouput_23.txt in a folder. After reading each file, i make 30% of my sample(total sample are 323) in each text file as -9999.0 then using scatter data interpolation, i interpolate these -9999.0 value and commute RMS error, AME, correlation.
UPDATE 2
S = dir('interpot_linear_*.txt');
N = sort({S.name});
for K = 1 : length(N)
infile = N{K};
whichfile = sscanf(infile, 'interpot_linear_%c%c');
% Load the data
data = load(infile);
% separate the data columns, just to make the code clear
Lat = data(:,1); % Column 1 is Latitude
Lon = data(:,2); % Column 2 is Longitude
Tmp = data(:,3); % Column 3 is Temperature
% Creating 30% of sample as -9999.0
n=size(data,1);
%n=323;
nr=round(n*0.3);
idx30=randperm(n,nr);
Tmp(idx30)=-9999.0;
% Find the "good" data points
good_temp = find(Tmp > -9999.000);
% find the "bad" data points
bad_temp = find(Tmp == -9999.000);
% creating vector
T = scatteredInterpolant(Lat(good_temp), Lon(good_temp), Tmp(good_temp), 'linear');
% use the interpolation object to interpolate temperature values
interp_values = T(Lat(bad_temp), Lon(bad_temp));
% replace the bad values with the interpolated values
Tmp(bad_temp) = interp_values;
%recall oringinal temperature column
Tmp_original=data(:,3);
% Here calculate RMS error
RMS=sqrt(sum((Tmp_original(:)-Tmp(:)).^2)/n);
% Here calculate mean absolute error
MAE=sum(abs(Tmp_original(:)-Tmp(:)))/n;
% Here calculate correlation coefficient
correl=corr(Tmp_original(:),Tmp(:));
%here i am spliting R^2 as two different terms
M_org= mean(Tmp_original); % mean of original temperature data.
M_ext= mean(Tmp); % mean of extimated temperature data.
std_org=std(Tmp_original); % standard deviation of orginal temp
std_ext=std(Tmp); % standard deviation of extimated temp.
total=length(Tmp_original);
M1=(Tmp_original(:)- M_org);
M2=(Tmp(:)- M_ext);
M1=M1';
% Here i am creating numminator of the formula
Nu=M1*M2; %giveing sum (M1*M2)
% Here i am creating dinominator of the formula
div=total*std_org*std_ext;
%R ^2
R=(Nu/div)^2;
rep(K,1)=RMS; rep(K,2)=MAE; rep(K,3)=correl; rep(K,4)=R; rep(K,5)=str2num(whichfile);
end
xlswrite('statistics',rep);
I want to export summary statistics of these 24 txt file in excel/text file which contains four columns i.e. first column is file no, second no RMS error, third column AME and fourth column correlation value for this file?
My one text file looks like this
21.500 60.500 295.867
21.500 61.500 295.828
21.500 62.500 295.828
21.500 63.500 295.867
21.500 64.500 296.102
21.500 65.500 296.234
21.500 66.500 296.352
21.500 67.500 296.336
21.500 68.500 296.305
21.500 69.500 298.281
21.500 70.500 301.828
21.500 71.500 302.094
21.500 72.500 299.469
21.500 73.500 301.711
21.500 74.500 302.317
21.500 75.500 302.757
21.500 76.500 303.030
21.500 77.500 303.137
21.500 78.500 303.078
22.500 60.500 295.477
22.500 61.500 295.484
22.500 62.500 295.516
22.500 63.500 295.547
22.500 64.500 295.852
22.500 65.500 295.859
22.500 66.500 295.852
22.500 67.500 295.711
22.500 68.500 295.969
22.500 69.500 298.562
22.500 70.500 300.828
22.500 71.500 302.352
22.500 72.500 300.570
22.500 73.500 301.383
22.500 74.500 301.311
22.500 75.500 301.381
22.500 76.500 301.692
22.500 77.500 301.837
22.500 78.500 301.814
23.500 60.500 294.906
23.500 61.500 294.898
23.500 62.500 295.000
23.500 63.500 295.078
23.500 64.500 295.297
23.500 65.500 295.359
23.500 66.500 295.297
23.500 67.500 295.312
23.500 68.500 296.664
23.500 69.500 298.781
23.500 70.500 299.211
23.500 71.500 300.109
23.500 72.500 301.000
23.500 73.500 301.594
23.500 74.500 302.000
23.500 75.500 300.911
23.500 76.500 300.520
23.500 77.500 300.702
23.500 78.500 300.718
24.500 60.500 294.578
24.500 61.500 294.516
24.500 62.500 294.734
24.500 63.500 294.789
24.500 64.500 294.844
24.500 65.500 294.562
24.500 66.500 294.734
24.500 67.500 296.367
24.500 68.500 297.438
24.500 69.500 298.531
24.500 70.500 298.453
24.500 71.500 299.195
24.500 72.500 300.062
24.500 73.500 300.351
24.500 74.500 301.055
24.500 75.500 300.958
24.500 76.500 300.512
24.500 77.500 299.734
24.500 78.500 299.787
25.500 60.500 296.258
25.500 61.500 296.391
25.500 62.500 296.672
25.500 63.500 296.398
25.500 64.500 295.773
25.500 65.500 295.812
25.500 66.500 296.609
25.500 67.500 297.977
25.500 68.500 297.109
25.500 69.500 297.828
25.500 70.500 298.430
25.500 71.500 298.836
25.500 72.500 298.703
25.500 73.500 300.207
25.500 74.500 300.110
25.500 75.500 300.013
25.500 76.500 299.917
25.500 77.500 299.470
25.500 78.500 299.023
26.500 60.500 294.484
26.500 61.500 298.266
26.500 62.500 296.773
26.500 63.500 296.892
26.500 64.500 297.012
26.500 65.500 297.131
26.500 66.500 297.250
26.500 67.500 296.188
26.500 68.500 295.938
26.500 69.500 296.906
26.500 70.500 297.828
26.500 71.500 299.312
26.500 72.500 299.359
26.500 73.500 299.262
26.500 74.500 299.165
26.500 75.500 299.069
26.500 76.500 298.972
26.500 77.500 298.875
26.500 78.500 296.773
27.500 60.500 292.710
27.500 61.500 295.880
27.500 62.500 294.643
27.500 63.500 295.710
27.500 64.500 296.362
27.500 65.500 296.333
27.500 66.500 296.452
27.500 67.500 295.352
27.500 68.500 295.148
27.500 69.500 295.750
27.500 70.500 295.750
27.500 71.500 296.070
27.500 72.500 295.227
27.500 73.500 297.534
27.500 74.500 297.437
27.500 75.500 297.340
27.500 76.500 297.870
27.500 77.500 297.405
27.500 78.500 296.609
28.500 60.500 290.935
28.500 61.500 293.494
28.500 62.500 292.513
28.500 63.500 293.580
28.500 64.500 294.647
28.500 65.500 295.715
28.500 66.500 295.951
28.500 67.500 295.773
28.500 68.500 295.375
28.500 69.500 295.438
28.500 70.500 294.664
28.500 71.500 294.906
28.500 72.500 294.812
28.500 73.500 295.805
28.500 74.500 296.335
28.500 75.500 296.864
28.500 76.500 296.731
28.500 77.500 294.557
28.500 78.500 294.696
29.500 60.500 289.161
29.500 61.500 291.108
29.500 62.500 290.383
29.500 63.500 291.450
29.500 64.500 292.517
29.500 65.500 293.585
29.500 66.500 294.652
29.500 67.500 295.719
29.500 68.500 296.797
29.500 69.500 293.375
29.500 70.500 294.305
29.500 71.500 294.070
29.500 72.500 293.750
29.500 73.500 295.539
29.500 74.500 295.859
29.500 75.500 296.057
29.500 76.500 292.532
29.500 77.500 292.799
29.500 78.500 292.924
30.500 60.500 287.387
30.500 61.500 288.722
30.500 62.500 288.253
30.500 63.500 289.320
30.500 64.500 290.387
30.500 65.500 291.455
30.500 66.500 292.522
30.500 67.500 292.884
30.500 68.500 294.198
30.500 69.500 295.394
30.500 70.500 293.320
30.500 71.500 292.930
30.500 72.500 293.570
30.500 73.500 294.648
30.500 74.500 295.383
30.500 75.500 290.535
30.500 76.500 290.929
30.500 77.500 291.182
30.500 78.500 291.294
31.500 60.500 285.613
31.500 61.500 286.336
31.500 62.500 286.123
31.500 63.500 287.190
31.500 64.500 288.257
31.500 65.500 289.325
31.500 66.500 289.239
31.500 67.500 290.049
31.500 68.500 291.364
31.500 69.500 292.678
31.500 70.500 293.992
31.500 71.500 293.422
31.500 72.500 294.438
31.500 73.500 294.141
31.500 74.500 288.564
31.500 75.500 289.087
31.500 76.500 289.468
31.500 77.500 289.707
31.500 78.500 289.805
32.500 60.500 283.839
32.500 61.500 283.950
32.500 62.500 283.993
32.500 63.500 285.060
32.500 64.500 286.127
32.500 65.500 286.272
32.500 66.500 285.726
32.500 67.500 287.214
32.500 68.500 288.529
32.500 69.500 289.843
32.500 70.500 291.847
32.500 71.500 294.312
32.500 72.500 294.812
32.500 73.500 286.621
32.500 74.500 287.271
32.500 75.500 287.781
32.500 76.500 288.148
32.500 77.500 288.374
32.500 78.500 288.458
33.500 60.500 282.065
33.500 61.500 281.564
33.500 62.500 281.863
33.500 63.500 282.930
33.500 64.500 283.306
33.500 65.500 282.759
33.500 66.500 282.405
33.500 67.500 284.380
33.500 68.500 285.694
33.500 69.500 287.238
33.500 70.500 289.703
33.500 71.500 291.025
33.500 72.500 284.704
33.500 73.500 285.483
33.500 74.500 286.120
33.500 75.500 286.616
33.500 76.500 286.970
33.500 77.500 287.182
33.500 78.500 287.253
34.500 60.500 280.290
34.500 61.500 279.178
34.500 62.500 279.733
34.500 63.500 280.339
34.500 64.500 279.792
34.500 65.500 279.246
34.500 66.500 279.278
34.500 67.500 281.545
34.500 68.500 282.859
34.500 69.500 285.093
34.500 70.500 287.237
34.500 71.500 282.814
34.500 72.500 283.722
34.500 73.500 284.487
34.500 74.500 285.111
34.500 75.500 285.593
34.500 76.500 285.933
34.500 77.500 286.132
34.500 78.500 286.189
35.500 60.500 278.516
35.500 61.500 276.792
35.500 62.500 277.373
35.500 63.500 276.826
35.500 64.500 276.279
35.500 65.500 275.732
35.500 66.500 276.150
35.500 67.500 278.710
35.500 68.500 280.484
35.500 69.500 283.450
35.500 70.500 280.952
35.500 71.500 281.987
35.500 72.500 282.881
35.500 73.500 283.633
35.500 74.500 284.243
35.500 75.500 284.712
35.500 76.500 285.039
35.500 77.500 285.224
35.500 78.500 285.267
36.500 60.500 276.742
36.500 61.500 274.406
36.500 62.500 273.859
36.500 63.500 273.313
36.500 64.500 272.766
36.500 65.500 272.219
36.500 66.500 273.023
36.500 67.500 275.875
36.500 68.500 279.662
36.500 69.500 279.117
36.500 70.500 280.280
36.500 71.500 281.302
36.500 72.500 282.182
36.500 73.500 282.920
36.500 74.500 283.517
36.500 75.500 283.972
36.500 76.500 284.285
36.500 77.500 284.457
36.500 78.500 284.487
37.500 60.500 277.406
37.500 61.500 277.547
37.500 62.500 276.375
37.500 63.500 275.484
37.500 64.500 276.820
37.500 65.500 275.312
37.500 66.500 274.875
37.500 67.500 275.875
37.500 68.500 277.308
37.500 69.500 278.600
37.500 70.500 279.750
37.500 71.500 280.758
37.500 72.500 281.624
37.500 73.500 282.349
37.500 74.500 282.932
37.500 75.500 283.374
37.500 76.500 283.674
37.500 77.500 283.832
37.500 78.500 283.849
So your problem is that in one of iterations the file that is loaded and assigned to data (in line 8 of your code) is empty,hence the size of data is [0,0].
I assume there is a file that is empty that's why you get this response.
So try to find that file,best way is run the script and see in which value of K you get the error and then navigate to the text file see whether it really is empty.
There are several issues in your code:
if your filenames are output_00.txt (e.g. they start with a lowercase "o") than you must change your first line of code to S = dir('output_*.txt');. Matlab is case-sensitive. If your file names start with a lowercase "o" then Matlab will never find files whose name start with "Output" (capital "O"). This will maybe solve the error in data. The same file name problem will affect the sscanf(), so also in sscanf() you must have the lowercase "o".
the RMSE formula is incorrect: you do not square both items and then subtract them, you must do the other way round; that is, subtraction first and then raise to the power. The correct formula is RMS=sqrt(sum((Tmp_original(:)-Tmp(:)).^2)/n);
the variables RMS, correl and MAE are scalars, so it is pointless to do the (:) operator, which is used to unwrap variables as column vectors
rep is declared as a 24x3 matrix but then with the line rep=[RMS(:);MAE(:);correl(:)]; you make rep a 3x1 vector.
in the final for loop there are a couple of issues: the first argument in xlmwrite() (e.g. Statistics) must be a string, not a variable (unless such variable contains the file name as a string). And the second argument must be replaced with rep.
Tmp and Tmp_original are both column vectors, so it is pointless to do the (:) operator. See above.
Since your main concern is regarding the saving-to-disk problem, I'll concentrate on that. My suggestion is to build rep as a matrix and then save such matrix outside the for-loop, once all of your files have been scanned and processed. As your code is now, it is not clear whether you want rep to be a matrix and save to disk all at once or you want rep to be a vector and save to disk in a file-by-file fashion.
the first thing to do then is to move rep=zeros(24,3); all the way up, before the for-loop starts. If you also want to append the file ID, then rep should actually be a 24x4 matrix.
change rep=[RMS(:);MAE(:);correl(:)]; to rep(k,1)=RMS; rep(k,2)=MAE; rep(k,3)=correl;. In this manner you write RMS on the k-th row and 1st column , then you write MAE on the k-th row and 2nd column and same story goes for correl. As k goes, this will fill the matrix rep. If you also want to append the file ID, keep in mind that whichfile is a string and you cannot concatenate strings and numbers into the same matrix. The immediate option is to convert whichfile from string to numeric thanks to str2num() but keep in mind that such conversion will remove the leading zeros (Matlab does not allow leading zeros) so the file ID 00 will be 0, the file 01 will be 1 and so on. So you might want to add rep(k,4)=str2num(whichfile); and this will also fill the 4th column in rep.
remove the inner for-loop, the one that contains xlmwrite(). Instead of writing a single line for every single file, we'll write the whole rep matrix in a batch mode.
after the main for-loop, put xlmwrite() as follows: xlmwrite('myFinalFile',rep); and if everything went ok, myFinalFile should contain your rep matrix as a 24x3 matrix. You might as well change myFinalFile with the file name you prefer.

Resources