


{"id":246913,"date":"2023-01-18T15:15:36","date_gmt":"2023-01-18T15:15:36","guid":{"rendered":"\/forum\/forums\/topic\/tread-command-reading-csv-files-containing-all-data\/"},"modified":"2023-01-18T15:15:36","modified_gmt":"2023-01-18T15:15:36","slug":"tread-command-reading-csv-files-containing-all-data","status":"closed","type":"topic","link":"https:\/\/innovationspace.ansys.com\/forum\/forums\/topic\/tread-command-reading-csv-files-containing-all-data\/","title":{"rendered":"*TREAD command, reading CSV-files containing all data."},"content":{"rendered":"<p>Hello,<\/p>\n<p>I&#8217;m facing some problems using the *TREAD command. My problem is that displaying my table with the *STATUS command, gives me one less column and row of data.<\/p>\n<p>I used the following code:<\/p>\n<div>\n<div>\/INQUIRE,filelines,LINES,my_file_path,CSV &nbsp; &nbsp; &nbsp;! Discover the number of lines in a text file<\/div>\n<div>numlines = filelines-skiplines&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;! numlines = filelines &#8211; skiplines (here: 1)<\/div>\n<div>*DEL, read_csv,,NOPR<\/div>\n<div>*DIM, &nbsp; read_csv,TABLE,numlines-1,numcols-1 &nbsp; &nbsp;! Create table array to hold data<\/div>\n<div>*TREAD, read_csv,fnames_input(1,1),CSV,,skiplines &nbsp; ! Import data into table<\/div>\n<div>*STATUS, read_csv<\/div>\n<div>&nbsp;<\/div>\n<div>I followed the instructions given here:&nbsp;<\/div>\n<div>https:\/\/simutechgroup.com\/using-tread-in-ansys-mechanical-apdl-to-read-external-data\/<\/div>\n<div>&nbsp;<\/div>\n<div>Because as described, entering the actual number of rows and columns for the relevant data leads to an unintentional shift of data.&nbsp;<\/div>\n<\/div>\n<p>This is the content of the CSV in my_file_path:<\/p>\n<table style=\"border-collapse: collapse;width: 240pt;height: 209px\" border=\"0\" width=\"320\" cellspacing=\"0\" cellpadding=\"0\">\n<colgroup>\n<col style=\"width: 238px\" span=\"4\" width=\"80\"> <\/colgroup>\n<tbody>\n<tr style=\"height: 26.125px\">\n<td style=\"height: 26.125px;width: 60pt\" width=\"80\" height=\"19\">Time<\/td>\n<td style=\"width: 60pt;height: 26.125px\" width=\"80\">Heatflux1<\/td>\n<td style=\"width: 60pt;height: 26.125px\" width=\"80\">Heatflux2<\/td>\n<td style=\"width: 60pt;height: 26.125px\" width=\"80\">Heatflux3<\/td>\n<\/tr>\n<tr style=\"height: 26.125px\">\n<td style=\"height: 26.125px\" align=\"right\" height=\"19\">0<\/td>\n<td style=\"height: 26.125px\" align=\"right\">301<\/td>\n<td style=\"height: 26.125px\" align=\"right\">88<\/td>\n<td style=\"height: 26.125px\" align=\"right\">62<\/td>\n<\/tr>\n<tr style=\"height: 26.125px\">\n<td style=\"height: 26.125px\" align=\"right\" height=\"19\">60<\/td>\n<td style=\"height: 26.125px\" align=\"right\">226.8<\/td>\n<td style=\"height: 26.125px\" align=\"right\">89<\/td>\n<td style=\"height: 26.125px\" align=\"right\">62<\/td>\n<\/tr>\n<tr style=\"height: 26.125px\">\n<td style=\"height: 26.125px\" align=\"right\" height=\"19\">120<\/td>\n<td style=\"height: 26.125px\" align=\"right\">149<\/td>\n<td style=\"height: 26.125px\" align=\"right\">90<\/td>\n<td style=\"height: 26.125px\" align=\"right\">62<\/td>\n<\/tr>\n<tr style=\"height: 26.125px\">\n<td style=\"height: 26.125px\" align=\"right\" height=\"19\">180<\/td>\n<td style=\"height: 26.125px\" align=\"right\">73<\/td>\n<td style=\"height: 26.125px\" align=\"right\">91<\/td>\n<td style=\"height: 26.125px\" align=\"right\">62<\/td>\n<\/tr>\n<tr style=\"height: 26.125px\">\n<td style=\"height: 26.125px\" align=\"right\" height=\"19\">240<\/td>\n<td style=\"height: 26.125px\" align=\"right\">0<\/td>\n<td style=\"height: 26.125px\" align=\"right\">91<\/td>\n<td style=\"height: 26.125px\" align=\"right\">62<\/td>\n<\/tr>\n<tr style=\"height: 26.125px\">\n<td style=\"height: 26.125px\" align=\"right\" height=\"19\">300<\/td>\n<td style=\"height: 26.125px\" align=\"right\">0<\/td>\n<td style=\"height: 26.125px\" align=\"right\">90<\/td>\n<td style=\"height: 26.125px\" align=\"right\">62<\/td>\n<\/tr>\n<tr style=\"height: 26.125px\">\n<td style=\"height: 26.125px\" align=\"right\" height=\"19\">360<\/td>\n<td style=\"height: 26.125px\" align=\"right\">0<\/td>\n<td style=\"height: 26.125px\" align=\"right\">90<\/td>\n<td style=\"height: 26.125px\" align=\"right\">62<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>This is the output I get with the code described above:<\/p>\n<p>&nbsp;LOCATION &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;VALUE<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;226.800000 &nbsp; &nbsp;&nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 2 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;149.000000 &nbsp; &nbsp;&nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;73.0000000 &nbsp; &nbsp;&nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 4 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;0.00000000 &nbsp; &nbsp;&nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 5 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;0.00000000 &nbsp; &nbsp;&nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 6 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;0.00000000 &nbsp; &nbsp;&nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; 2 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;89.0000000 &nbsp; &nbsp;&nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 2 &nbsp; &nbsp; &nbsp; 2 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;90.0000000 &nbsp; &nbsp;&nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; 2 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;91.0000000 &nbsp; &nbsp;&nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 4 &nbsp; &nbsp; &nbsp; 2 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;91.0000000 &nbsp; &nbsp;&nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 5 &nbsp; &nbsp; &nbsp; 2 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;90.0000000 &nbsp; &nbsp;&nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 6 &nbsp; &nbsp; &nbsp; 2 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;90.0000000 &nbsp; &nbsp;&nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;62.0000000 &nbsp; &nbsp;&nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 2 &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;62.0000000 &nbsp; &nbsp;&nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;62.0000000 &nbsp; &nbsp;&nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 4 &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;62.0000000 &nbsp; &nbsp;&nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 5 &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;62.0000000 &nbsp; &nbsp;&nbsp;<br \/>&nbsp; &nbsp; &nbsp; &nbsp; 6 &nbsp; &nbsp; &nbsp; 3 &nbsp; &nbsp; &nbsp; 1 &nbsp; &nbsp;62.0000000 &nbsp; &nbsp;&nbsp;<\/p>\n<p>Is there any way to get the first row and column included in my table without changing the csv-file?<\/p>\n<p>Thanks a lot in advance.<\/p>\n","protected":false},"template":"","class_list":["post-246913","topic","type-topic","status-closed","hentry","topic-tag-csv-1","topic-tag-ansys-mechanical","topic-tag-apdl","topic-tag-excel-2","topic-tag-excel-csv","topic-tag-table","topic-tag-tread"],"aioseo_notices":[],"acf":[],"custom_fields":[{"0":{"_bbp_subscription":["272932","18229","20905","170445"],"_bbp_author_ip":["96.7.74.173"]," _bbp_last_reply_id":["0"]," _bbp_likes_count":["0"],"_btv_view_count":["3320"],"_bbp_topic_status":["unanswered"],"_bbp_status":["publish"],"_bbp_topic_id":["246913"],"_bbp_forum_id":["27791"],"_bbp_engagement":["18229","20905","170445","272932"],"_bbp_voice_count":["4"],"_bbp_reply_count":["6"],"_bbp_last_reply_id":["247335"],"_bbp_last_active_id":["247335"],"_bbp_last_active_time":["2023-01-24 10:33:08"]},"test":"ermanno-mancaoutlook-de"}],"_links":{"self":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/246913","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics"}],"about":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/topics\/246913\/revisions"}],"wp:attachment":[{"href":"https:\/\/innovationspace.ansys.com\/forum\/wp-json\/wp\/v2\/media?parent=246913"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}