matlab.ui.control.Table append column to new line of text file with space delimiters
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi Guys,
I really need help with this.
I have a UITable in App Designer with 3 columns. Column 1 contains a counter for the number of rows, column 2 contains a number between 100 and 500, and column 3 contains a decimal number between 0 and 1.
I need to get the contents of column 2 and append it in a new line of a text file in a row with space delimeters. For example:
Text File:
196 196 294 294 329 329 294 262 262 247 247 220 220 196 294 294 262 262 247 247 220 294 294 262 262 247 247 220 196 196 294 294 329
247 247 262 294 294 262 247 220 196 196 220 247 247 220 220 247 247 262 294 294 262 247 220 196 196 220 247 220 196 196 220 220 247 196 220 247 262
Text file after appended data from column 2:
196 196 294 294 329 329 294 262 262 247 247 220 220 196 294 294 262 262 247 247 220 294 294 262 262 247 247 220 196 196 294 294 329
247 247 262 294 294 262 247 220 196 196 220 247 247 220 220 247 247 262 294 294 262 247 220 196 196 220 247 220 196 196 220 220 247 196 220 247 262
220 196 294 220 247 247 196 220 220 247 196 247 247 262
I also need to do the same thing for column 3 aswell, I imagine the code will look very similar.
Thank you so much for your help.
댓글 수: 0
채택된 답변
Krishna Zanwar
2019년 2월 7일
Lets say the handle of your UI table is uit,
To get ui table data
D=get(uit,'Data');
Now you have the data from the table in variable ‘D’
fileId=fopen('krishna.txt','w') %to create a new text file
fprintf(fileId,'\n');
fprintf(fileId,'%d',D(:,3)); %To print third column
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!