How can I import and display this table in Octave, because textread does not work

I4-prerez.txt (247 Bytes)

You could use textscan. The first column looks like string labels, while the second looks like floating point numbers thus I would do something like:

id = fopen ('I4-prerez.txt');
data = textscan (id, "%s,%f");
3 Likes

The simplest would be to do the display in a for loop if you are used to printf. Another solution, which is probably overkill, is to use a table from the tablicious package:

pkg load tablicious
Surface = data{1};
Moment = data{2};
tab = table (Surface, Moment);
prettyprint (tab)

That should look like this

---------------------
| Surface | Moment  |
---------------------
| IP-8    | 19500   |
| IP-10   | 34200   |
| IP-12   | 54700   |
| IP-14   | 81900   |
| IP-18   | 161500  |
| IP-20   | 214000  |
| IP-22   | 278700  |
| IP-26   | 442100  |
| IP-28   | 543100  |
| IP-30   | 653000  |
| IP-32   | 782100  |
| IP-36   | 1090000 |
| IP-38   | 1250000 |
| IP-40   | 1460000 |
---------------------

Could you clarify that?

Is that what you are looking for?

...
moments = sort (data{2});
smallest = @(M, sigma_max) moments(find (moments > M/sigma_max)(1));
smallest (15e6, 130)
printf ("\n________________________\n")
printf ("Surface\t|Moment")
printf ("\n________________________\n")
for ii = 1:numel (data{1})
  printf ("%s\t|%f\n", data{1}{ii}, data{2}(ii))
endfor
1 Like

qw
asasas

Seems you edited all your posts, which will prevent search engine from finding this thread, which may be helpful for others.
Can you please edit again to show the original content?

Reverted vandalism (where possible).

2 Likes