-5
\$\begingroup\$

I am having a hard time adding an exported text-delimited by space output to the table format in Electrical Engineering Stack Exchange. This is detailed in the Tables and Alignment Sections in this link.

An example table is as follows. I cut it from Excel and Pasted it into the Online HTML editor and then copied the relevant source and pasted it here. But it is not formatting correctly.


 

pixel x pixel y x value -1.0*VDS (Volts) y value -1.0*ID (Amps) "10^((x-199)/(570-199)" %Rel Error 199 553 1 0.3 1 0.00% 310 553 2 0.3 1.991550735 -0.42% 375 553 3 0.3 2.981216601 -0.63% 423 553 4 0.3 4.015813958 0.40% 458 553 5 0.3 4.990145486 -0.20% 487 553 6 0.3 5.974207785 -0.43% 513 553 7 0.3 7.020389144 0.29% 533 553 8 0.3 7.948213819 -0.65% 552 553 9 0.3 8.942984536 -0.63% 570 553 10 0.3 10 0.00%

 

I had this idea that maybe an Online C Compiler like as linked could be used.

I wrote this sample code to test the idea of writing a program that I could cut and paste with that would format the output as a Stack Exchange Electrical Engineering centered table, but this is more a proof-of-concept versus a full answer to the problem:

/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <stdio.h>

int main()
{
    char mystring[50];
    printf("Hello World \n");
    scanf("%s",mystring);
    printf("%s\n",mystring);
    printf("\n");
    scanf("%s",mystring);
    printf("%s\n",mystring);
    printf("\n");
    return 0;
}

I also updated the C-code to see if it could read in percentages as floating point numbers. That also seems to work with the new code below. So in principle, it seems that the online C-compiler should be able to receive a paste from the data copied into this question to format according to the pipe formatting needed by the Stack Exchange Electronics site:

/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <stdio.h>

int main()
{
    char mystring[50];
    float myfloat1;
    printf("Hello World \n");
    scanf("%s",mystring);
    printf("%s",mystring);
    printf("\n");
    scanf("%s",mystring);
    printf("%s",mystring);
    printf("\n");
    printf("Try now to input a percentage number:\n");
    scanf("%f",&myfloat1);
    printf("\n %f \n Done!",myfloat1);
    return 0;
}

What can be done to convert Excel or Libre Office Spreadsheet data to the centered table format supported by the Stack Exchange Electrical Engineering site?

Update: I just received the comment from the moderator SamGibson, and I am trying to understand what he wrote.

I attempted to make the table as below, exporting from Libre Office Calc the selection as .csv and renaming the extension to .txt, with some small editing:

|"pixel x"|"pixel y"|"x value -1.0VDS (Volts)"|"y value -1.0ID (Amps)"|"""10^((x-199)/(570-199)"""|"%Rel Error"|

|199|553|1|0.3|1|0.00%|

|310|553|2|0.3|1.9915507353276|-0.42%|

|375|553|3|0.3|2.98121660134078|-0.63%|

|423|553|4|0.3|4.01581395812115|0.40%|

|458|553|5|0.3|4.99014548635398|-0.20%|

|487|553|6|0.3|5.97420778511007|-0.43%|

|513|553|7|0.3|7.0203891441092|0.29%|

|533|553|8|0.3|7.94821381907615|-0.65%|

|552|553|9|0.3|8.94298453606794|-0.63%|

|570|553|10|0.3|10|0.00%|

|"pixel x"|"pixel y"|"x value -1.0*VDS (Volts)"|"y value -1.0*ID (Amps)"|"""10^((x-199)/(570-199)"""|"%Rel Error"|
-----------------------------------------------------------------------------------------
|199|553|1|0.3|1|0.00%|
-----------------------
|310|553|2|0.3|1.9915507353276|-0.42%|
--------------------------------------
|375|553|3|0.3|2.98121660134078|-0.63%|
---------------------------------------
|423|553|4|0.3|4.01581395812115|0.40%|
--------------------------------------
|458|553|5|0.3|4.99014548635398|-0.20%|
---------------------------------------
|487|553|6|0.3|5.97420778511007|-0.43%|
---------------------------------------
|513|553|7|0.3|7.0203891441092|0.29%|
-------------------------------------
|533|553|8|0.3|7.94821381907615|-0.65%|
---------------------------------------
|552|553|9|0.3|8.94298453606794|-0.63%|
---------------------------------------
|570|553|10|0.3|10|0.00%|
-------------------------

But as above, that is not working. It seems like the programming is still the most promising first approach. But if I cannot get a sample table working, either approach cannot succeed. My next attempt, I hope, is to copy and paste from the link provided by the moderator. Perhaps I can get better progress there.

I remember posting a table before as a draft answer to a different question on Math Stack Exchange:

$$\begin{array}{c|c|c|c|c|c|c|c|c|c} & {a_0=0} & {a_0=1} & {a_0=2} & {a_0=3} & {a_0=4} & {a_0=5} & {a_0=6} & {a_0=7} & {a_0=8} & {a_0=9} \\ \hline {a_1= 0} & 0 & \textbf{1} & 4 & 9 & 16 & 25 & 36 & 49 & 64 & 81 \\ \hline {a_1= 1} & 0 & 21 & 44 & 69 & 96 & 25 & \textbf{56} & 89 & 24 & 61 \\ \hline {a_1= 2} & 0 & 41 & 84 & 29 & 76 & 25 & 76 & 29 & 84 & 41 \\ \hline {a_1= 3} & 0 & 61 & 24 & \textbf{89} & \textbf{56} & 25 & 96 & 69 & 44 & 21 \\ \hline {a_1= 4} & 0 & 81 & 64 & 49 & 36 & 25 & 16 & 9 & 4 & \textbf{1} \\ \hline {a_1= 5} & 0 & \textbf{1} & 4 & \textbf{9} & 16 & 25 & 36 & 49 & 64 & 81 \\ \hline {a_1= 6} & 0 & 21 & 44 & 69 & 96 & 25 & 56 & \textbf{89} & 24 & 61 \\ \hline {a_1= 7} & 0 & 41 & 84 & 29 & 76 & 25 & 76 & 29 & 84 & 41 \\ \hline {a_1= 8} & 0 & 61 & 24 & \textbf{89} & \textbf{56} & 25 & 96 & 69 & 44 & 21 \\ \hline {a_1= 9} & 0 & 81 & 64 & 49 & 36 & 25 & 16 & 9 & 4 & \textbf{1} \\ \hline \end{array}$$

A copy and paste of that table seems to render fine now. But why not also the recommended format at the moderator's link?

$$\begin{array}{c|c|c|c|c|c|c|c|c|c} 
 & {a_0=0} & {a_0=1} & {a_0=2} & {a_0=3} & {a_0=4} & {a_0=5} & {a_0=6} & {a_0=7} & {a_0=8} & {a_0=9} \\ \hline  
{a_1= 0}  &  0  &  \textbf{1}  &  4  &  9  & 16  & 25  & 36  & 49  & 64  & 81 \\ \hline 
{a_1= 1}  &  0  & 21  & 44  & 69  & 96  & 25  & \textbf{56}  & 89  & 24  & 61 \\ \hline 
{a_1= 2}  &  0  & 41  & 84  & 29  & 76  & 25  & 76  & 29  & 84  & 41 \\ \hline 
{a_1= 3}  &  0  & 61  & 24  & \textbf{89}  & \textbf{56}  & 25  & 96  & 69  & 44  & 21 \\ \hline 
{a_1= 4}  &  0  & 81  & 64  & 49  & 36  & 25  & 16  &  9  &  4  &  \textbf{1} \\ \hline 
{a_1= 5}  &  0  &  \textbf{1}  &  4  &  \textbf{9}  & 16  & 25  & 36  & 49  & 64  & 81 \\ \hline 
{a_1= 6}  &  0  & 21  & 44  & 69  & 96  & 25  & 56  & \textbf{89}  & 24  & 61 \\ \hline 
{a_1= 7}  &  0  & 41  & 84  & 29  & 76  & 25  & 76  & 29  & 84  & 41 \\ \hline 
{a_1= 8}  &  0  & 61  & 24  & \textbf{89}  & \textbf{56}  & 25  & 96  & 69  & 44  & 21 \\ \hline 
{a_1= 9}  &  0  & 81  & 64  & 49  & 36  & 25  & 16  &  9  &  4  &  \textbf{1} \\ \hline
\end{array}$$

The table quote from the Stack Electronics formatting link is:

Alignment
You can set the alignment of a table column by including a : in the corresponding cell of the separator line. A : on the left will make a column left-aligned (this is the default). A : on the right will make it right-aligned. Both left and right :s will produce a center-aligned column.

| left | center | right |
|:---- |:------:| -----:|
| One  | Two    | Three |
left center right
One Two Three

Its example seems to render fine, so there must be a mistake in my copy, adjust and paste:

pixel x pixel y \$x_{value} = -1.0*V_{DS} (Volts)\$ \$y_{value} = -1.0*I_{DS} (Amps)\$ \$10^{\left({\frac{x-199}{570-199}}\right)}\$ %Rel Error
199 553 1 0.3 1 0.00%
310 553 2 0.3 1.9915507353276 -0.42%
375 553 3 0.3 2.98121660134078 -0.63%
423 553 4 0.3 4.01581395812115 0.40%
458 553 5 0.3 4.99014548635398 -0.20%
487 553 6 0.3 5.97420778511007 -0.43%
513 553 7 0.3 7.0203891441092 0.29%
533 553 8 0.3 7.94821381907615 -0.65%
552 553 9 0.3 8.94298453606794 -0.63%
570 553 10 0.3 10 0.00%

The formatting is a lot simpler than expected. Only the top line needs to be formatted in terms of centering and then all the other lines can be formatted with pipe-separation as shown in the code below, and it also supports in-line MathJax (like the moderator SamGibson suggested in his comment link):

|pixel x|pixel y|\$x_{value} = -1.0*V_{DS} (Volts)\$|\$y_{value} = -1.0*I_{DS} (Amps)\$|\$10^{\frac{(x-199)}{570-199}}\$| %Rel Error|
|:-------:|:-------:|:------------------------:|:------:|:-----------:|:-------:|:----------:|
|199|553|1|0.3| 1 |0.00%|
|310|553|2|0.3|1.9915507353276|-0.42%|
|375|553|3|0.3|2.98121660134078|-0.63%|
|423|553|4|0.3|4.01581395812115|0.40%|
|458|553|5|0.3|4.99014548635398|-0.20%|
|487|553|6|0.3|5.97420778511007|-0.43%|
|513|553|7|0.3|7.0203891441092|0.29%|
|533|553|8|0.3|7.94821381907615|-0.65%|
|552|553|9|0.3|8.94298453606794|-0.63%|
|570|553|10|0.3|10|0.00%|

Thank you so much @SamGibson for your help!

P.S. The total data that I need to convert is as follows. I probably am best able to do this by hand (as when I tried to save the .csv file, it wrote spaces instead of the " | " that I selected from Libre Office Calc):

pixel x pixel y x value -1.0*VDS (Volts) y value -1.0*ID (Amps) "10^((x-199)/(570-199)" %Rel Error 
199 553 1 0.3 1 0.00% 
310 553 2 0.3 1.9915507353276 -0.42% 
375 553 3 0.3 2.98121660134078 -0.63% 
423 553 4 0.3 4.01581395812115 0.40% 
458 553 5 0.3 4.99014548635398 -0.20% 
487 553 6 0.3 5.97420778511007 -0.43% 
513 553 7 0.3 7.0203891441092 0.29% 
533 553 8 0.3 7.94821381907615 -0.65% 
552 553 9 0.3 8.94298453606794 -0.63% 
570 553 10 0.3 10 0.00% 
      
pixel x pixel y x value -1.0*VDS (Volts) y value -1.0*ID (Amps) "0.3*10^((553-B16)/(553-95)*LOG10(10/0.3))" %Rel Error 
199 553 1 0.3 0.3 0.00% 
199 516 1 0.4 0.398243390711311 -0.44% 
199 487 1 0.5 0.497250692994845 -0.55% 
199 461 1 0.6 0.606774091786575 1.13% 
199 444 1 0.7 0.691119418912026 -1.27% 
199 423 1 0.8 0.811669849518273 1.46% 
199 409 1 0.9 0.903504442965924 0.39% 
199 397 1 1 0.990446554846937 -0.96% 
199 306 1 2 1.98797883826677 -0.60% 
199 252 1 3 3.00583506361531 0.19% 
199 216 1 4 3.95974670163074 -1.01% 
199 186 1 5 4.98217856136972 -0.36% 
199 162 1 6 5.98715904298754 -0.21% 
199 142 1 7 6.97785676097214 -0.32% 
199 125 1 8 7.9478217266908 -0.65% 
199 108 1 9 9.05261778266397 0.58% 
199 95 1 10 10 0.00% 
      
X-test number X-pixel Y-pixel X VSD Volts Y ISD Amps VSD*(VSG-|Vth|-VSD/2) Vth=5-3.172106
0 199 440 1 0.712612353661397 0.636217589264131 1.827894
1 218 429 1.12515651184475 0.775227262665853 0.699079949306941 
2 236 419 1.25814431111547 0.836911749306287 0.761788807988367 
3 255 410 1.41560926449199 0.896613409518565 0.830594792272518 
4 273 401 1.58292710759221 0.960573927651115 0.897236801739806 
5 292 394 1.78104074288295 1.01345911713713 0.967525937757871 
6 310 391 1.9915507353276 1.03700636554499 1.03197277252208 
7 329 385 2.24080627852305 1.08575490208759 1.09463861931262 
8 347 382 2.50565822795025 1.1109819092329 1.14501573662911 
9 366 378 2.81925767163559 1.14553203332066 1.18306950235251 
10 385 375 3.17210612780905 1.17214793414156 1.19789120589378 
11 403 374 3.54703300113696 1.18115662231606 1.18115660226839 
12 422 374 3.99096727895747 1.18115662231606 1.18115660226839 
13 440 371 4.46267939171929 1.20860024379417 1.18115660226839 
14 459 372 5.02121277786831 1.19938224296495 1.18115660226839 
15 477 371 5.61469468902386 1.20860024379417 1.18115660226839 
16 496 372 6.31741029137531 1.19938224296495 1.18115660226839 
17 514 370 7.06409618164559 1.21788909071087 1.18115660226839 
18 533 368 7.94821381907615 1.23668150497697 1.18115660226839 
19 551 369 8.88765242410989 1.22724932821141 1.18115660226839 
20 570 367 10 1.2461861739057 1.18115660226839 

In the meanwhile there is now a raw data-dump, that although it is not so pretty, other Electrical Engineers can reference to see how good their library models are. I have not marked the answers to the main problem on Stack Exchange Electronics that I have received as completely good yet since I have not seen any comparison with the data sheet with the PMOS transistor biased at \$V_{SG}=5\text{ } Volts\$. Based on the spreadsheet results that I have separately, the Level 1 Model is excellent. But I need to explain the parameters and the proofs sufficiently so that someone without the spreadsheet can see how I arrived at the solution. Hopefully I can update the data-dump here so I can reduce the number of updates to the question that I posted on Stack Exchange Electronics to address moderator concerns of too many updates on that forum.

Update: I developed a C-program to help correct the format of the data to the pipe-stye needed by Electrical Engineering Stack Exchange, line-by-line (with a simple copy and paste), with its input output as follows (with the online C compiler):

Scan in data now by pasting or typing:
Type in line 0: 
199 553 1 0.3 1 0.00
Type in line 1: 
310 553 2 0.3 1.9915507353276 -0.42
Type in line 2: 
375 553 3 0.3 2.98121660134078 -0.63
Type in line 3: 
423 553 4 0.3 4.01581395812115 0.40
Type in line 4: 
458 553 5 0.3 4.99014548635398 -0.20
Type in line 5: 
487 553 6 0.3 5.97420778511007 -0.43
Type in line 6: 
513 553 7 0.3 7.0203891441092 0.29
Type in line 7: 
533 553 8 0.3 7.94821381907615 -0.65
Type in line 8: 
552 553 9 0.3 8.94298453606794 -0.63
Type in line 9: 
570 553 10 0.3 10 0.00
The formatted data is as follows:
|199|553|1|0.300000|1.000000|0.000000|
|310|553|2|0.300000|1.991551|-0.420000|
|375|553|3|0.300000|2.981217|-0.630000|
|423|553|4|0.300000|4.015814|0.400000|
|458|553|5|0.300000|4.990146|-0.200000|
|487|553|6|0.300000|5.974208|-0.430000|
|513|553|7|0.300000|7.020389|0.290000|
|533|553|8|0.300000|7.948214|-0.650000|
|552|553|9|0.300000|8.942985|-0.630000|
|570|553|10|0.300000|10.000000|0.000000|

 All Done! 

Its C code is easily adaptable and is as follows:

/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <stdio.h>

int main()
{
    unsigned int myintarray[30];

    unsigned int uint0;
    unsigned int uint1;
    unsigned int uint2;

    float myfloatarray[30];
    float float0;
    float float1;
    float float2;

    int ictr;
    int jctr;
    
    /*Scan in the data that needs formatting */
    printf("Scan in data now by pasting or typing:\n");
    for (ictr=0; ictr<10; ictr++){
            printf("Type in line %d: \n", ictr);
            scanf("%u %u %u %f %f %f", &uint0, &uint1, &uint2, &float0, &float1, &float2);
            myintarray[ictr*3+0]=uint0;
            myintarray[ictr*3+1]=uint1;
            myintarray[ictr*3+2]=uint2;
            myfloatarray[ictr*3+0]=float0;
            myfloatarray[ictr*3+1]=float1;
            myfloatarray[ictr*3+2]=float2;
        }

    /*Print out the data the formatted data */
    printf("The formatted data is as follows:\n");
    for (ictr=0; ictr<10; ictr++){
        for (jctr=0; jctr<3; jctr++) {
            /* Read in the decimal values */
            printf("|%u", myintarray[ictr*3+jctr]);
        }
        for (jctr=0; jctr<3; jctr++) {
            /* Read in the float values */
            printf("|%f", myfloatarray[ictr*3+jctr]);

        }
        printf("|\n");
    }
    printf("\n All Done! \n");
    return 0;
}

When I copy and paste its output together with a hand-written header (and added percentage signs), it generates the following table (which details the \$X_{axis}\text{ }V_{DS\text{ }Volts}\$ versus pixel position in the data sheet data graph:

pixel x pixel y \$x_{value} = -1.0*V_{DS} (Volts)\$ \$y_{value} = -1.0*I_{DS} (Amps)\$ \$10^{\left(\frac{x-199}{570-199}\right)}\$ %Rel Error
199 553 1 0.300000 1.000000 0.000000%
310 553 2 0.300000 1.991551 -0.420000%
375 553 3 0.300000 2.981217 -0.630000%
423 553 4 0.300000 4.015814 0.400000%
458 553 5 0.300000 4.990146 -0.200000%
487 553 6 0.300000 5.974208 -0.430000%
513 553 7 0.300000 7.020389 0.290000%
533 553 8 0.300000 7.948214 -0.650000%
552 553 9 0.300000 8.942985 -0.630000%
570 553 10 0.300000 10.000000 0.000000%

All the other tables need to be updated so that they are ready to cut and paste with their applicable adjusted C-code. (I estimate that updating the C-code should be relatively easy, now that the prototype has been written and documented here.)

Update: I updated the C code into two parts (the header, and the row data). The Online C Compiler was crashing with my first version of the code with the two parts together but very thankfully the two parts ran fantastically together to generate first the header and the rows. I am just posting here to start with the result and then I want to get to the updated C code. I just copied and pasted directly the selected header data (no spaces for each header item) and row data from the LibreOffice Calc Spreadsheet:

Pixel-x Pixel-y X-value(-1.0*VDS(Volts)) y-value(-1.0*ID(Amps)) 0.3*10^((553-B16)/(553-95)*LOG10(10/0.3)) %Rel-Error
199 553 1 0.300000 0.300000 0.00%
199 516 1 0.400000 0.398243 -0.44%
199 487 1 0.500000 0.497251 -0.55%
199 461 1 0.600000 0.606774 1.13%
199 444 1 0.700000 0.691119 -1.27%
199 423 1 0.800000 0.811670 1.46%
199 409 1 0.900000 0.903504 0.39%
199 397 1 1.000000 0.990447 -0.96%
199 306 1 2.000000 1.987979 -0.60%
199 252 1 3.000000 3.005835 0.19%
199 216 1 4.000000 3.959747 -1.01%
199 186 1 5.000000 4.982179 -0.36%
199 162 1 6.000000 5.987159 -0.21%
199 142 1 7.000000 6.977857 -0.32%
199 125 1 8.000000 7.947822 -0.65%
199 108 1 9.000000 9.052618 0.58%
199 95 1 10.000000 10.000000 0.00%

As can be seen, the top "---" header second line changes the width of each column as it is displayed.

| Pixel-x | Pixel-y | X-value(-1.0*VDS(Volts)) | y-value(-1.0*ID(Amps)) | 0.3*10^((553-B16)/(553-95)*LOG10(10/0.3)) | %Rel-Error |
|:-------:|:-------:|:------------------------:|:----------------------:|:-----------------------------------------:|:----------:|
| 199 | 553 | 1 | 0.300000 | 0.300000 | 0.00% | 
| 199 | 516 | 1 | 0.400000 | 0.398243 | -0.44% | 
| 199 | 487 | 1 | 0.500000 | 0.497251 | -0.55% | 
| 199 | 461 | 1 | 0.600000 | 0.606774 | 1.13% | 
| 199 | 444 | 1 | 0.700000 | 0.691119 | -1.27% | 
| 199 | 423 | 1 | 0.800000 | 0.811670 | 1.46% | 
| 199 | 409 | 1 | 0.900000 | 0.903504 | 0.39% | 
| 199 | 397 | 1 | 1.000000 | 0.990447 | -0.96% | 
| 199 | 306 | 1 | 2.000000 | 1.987979 | -0.60% | 
| 199 | 252 | 1 | 3.000000 | 3.005835 | 0.19% | 
| 199 | 216 | 1 | 4.000000 | 3.959747 | -1.01% | 
| 199 | 186 | 1 | 5.000000 | 4.982179 | -0.36% | 
| 199 | 162 | 1 | 6.000000 | 5.987159 | -0.21% | 
| 199 | 142 | 1 | 7.000000 | 6.977857 | -0.32% | 
| 199 | 125 | 1 | 8.000000 | 7.947822 | -0.65% | 
| 199 | 108 | 1 | 9.000000 | 9.052618 | 0.58% | 
| 199 | 95 | 1 | 10.000000 | 10.000000 | 0.00% | 

Below is the updated C Header Capture code to run on the Online C Compiler by copying and pasting it there and then running it:

/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

/******************************************************************************
    C Code to Process StackExchage Table Header from a SpreadSheet
*******************************************************************************/

#include <stdio.h>
#include <string.h>

int main()
{
    char mystra[6][300];

    int ictr;
    int jctr;
    
    /*Scan in the data that needs formatting */
    printf("Scan in data now by pasting or typing:\n");
    scanf("%s %s %s %s %s %s", mystra[0],mystra[1],mystra[2],mystra[3],mystra[4],mystra[5]);
    printf("Printing the header:\n");
    printf("| %s | %s | %s | %s | %s | %s |\n", mystra[0],mystra[1],mystra[2],mystra[3],mystra[4],mystra[5]);

    printf("|");
    for (jctr=0; jctr<6; jctr++)
    {
        printf(":");
        for (ictr=0; ictr<strlen(mystra[jctr]); ictr++) printf("-");
        printf(":|");
    }
    printf("\n");
    printf("\n All Done! \n");
    return 0;
}

And the Updated C code to process the rows is as follows:

/******************************************************************************

                            Online C Compiler.
                Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

/******************************************************************************
                         Program Process Stack Exchange Data Rows 
*******************************************************************************/                           

#include <stdio.h>

int main()
{
    unsigned int uint0;
    unsigned int uint1;
    unsigned int uint2;

    float float0;
    float float1;
    float float2;

    int ictr;
    int ictrstart;
    int ictrfinish;    
    
    char str1[40];
    
/*Scan and format row lines */
    printf("Enter start row number: "); scanf("%d",&ictrstart);
    printf("Enter final row number: "); scanf("%d",&ictrfinish);    
    for (ictr=ictrstart; ictr<=ictrfinish; ictr++){
            printf("Type in line %d: \n", ictr);
            scanf("%u %u %u %f %f %f%s", &uint0, &uint1, &uint2, &float0, &float1, &float2,str1);
        printf("| %u | %u | %u | %f | %f | %.2f%s | \n", uint0, uint1, uint2, float0, float1, float2,"%");
        }

    printf("\n All Done! \n");
    return 0;
}

Please note that depending on the data-structures, these both need small adjustments, but the effort should not be so much in comparison with how much time saved for typing formatting data a very large amount of data.

Especially since it processes on-line without local compiling, the small effort is well worth it. Now there are tables for the X-axis data and its model as well as the Y axis data and its model. The next table to copy and paste from the spreadsheet is the V-I curve and its model, from the spreadsheet:

\$ X_{V\text{ }SD}\left(Volts\right)\$ \$Y_{I\text{ }SD}(Amps)\$ \$ I_{SD}=K_p 2 W_{eff} L_{eff}(1+λ V_{SD})\left(V_{SG}−|Vth|\right)^2 \$ \$\frac{ΔY}{ΔX}\$
1.00000000 0.71261233 0.70234478 0.71261233
1.12515652 0.77522725 0.76905370 0.50029284
1.25814426 0.83691174 0.83474886 0.46383569
1.41560924 0.89661342 0.90561485 0.37914252
1.58292711 0.96057391 0.97267991 0.38226956
1.78104079 1.01345909 1.04109907 0.26694372
1.99155068 1.03700638 1.10071766 0.11185810
2.24080634 1.08575487 1.15384483 0.19557653
2.50565815 1.11098194 1.18949735 0.09524947
2.81925774 1.14553201 1.20392942 0.11017279
3.17210603 1.17214799 1.20527661 0.07543153
3.54703307 1.18115664 1.20670807 0.02402785
3.99096727 1.18115664 1.20840311 0.00000000
4.46267939 1.20860028 1.21020412 0.05817875
5.02121258 1.19938219 1.21233678 -0.01650394
5.61469460 1.20860028 1.21460271 0.01553207
6.31741047 1.19938219 1.21728575 -0.01311768
7.06409597 1.21788907 1.22013676 0.02478532
7.94821405 1.23668146 1.22351241 0.02125556
8.88765240 1.22724938 1.22709930 -0.01004023
10.00000000 1.24618614 1.23134637 0.01702422
\$\endgroup\$
8
  • 3
    \$\begingroup\$ Stephen Elliott - Hi, (a) Just to be clear: You called the desired output format: "text-delimited by space" - but it isn't, is it? The table format supported on this site is described here (linking to the full details in the original spec on GitHub) and it's not space delimited, but pipe-symbol delimited. Why did you call it "text-delimited by space"? (b) Have you looked at starting with CSV output format, then changing the separators & adding the required initial header & separator rows? \$\endgroup\$
    – SamGibson Mod
    Dec 25, 2023 at 17:35
  • \$\begingroup\$ Stephen Elliott - Hi, Re-reading your question, I think I may have misinterpreted it. I now think you're saying that your input table values were originally "delimited by spaces". To be honest, trying to convert that example set of input values into HTML (and then saying it isn't formatting correctly) is IMHO a waste of time - SE deliberately does not support all HTML, so pasting in HTML from that "Online HTML Editor" is adding problems rather than helping. Anyway, as I'm not sure that I understand all details of the question, I'll stop here. Hopefully someone else can understand & help. \$\endgroup\$
    – SamGibson Mod
    Dec 26, 2023 at 10:30
  • \$\begingroup\$ (FYI the syntax is wrong in your question rev 4. Please do look at the "Table" section in the editing help that I linked.) \$\endgroup\$
    – SamGibson Mod
    Dec 26, 2023 at 10:38
  • 1
    \$\begingroup\$ Stephen Elliott - Hi, Reading your updates, it seems you have now achieved what you wanted to do (I think?). If so, please do not leave the final solution in the question. Instead, remove the solution from the question, write a self-answer & post the solution there. Then, if no-one writes a better answer in the meantime, you can áccept your self-answer to show that the topic is solved. \$\endgroup\$
    – SamGibson Mod
    Dec 28, 2023 at 0:20
  • \$\begingroup\$ @SamGibson I still do not have all parts of the question complete. I try at the end of the question to mention what is needed to get an up-vote from me. In this case, I noted that there still needs to be a table for the curve that is part of the text data in the question. When that part is complete, I can update my Stack Exchange Electronics question with these three tables and their graphs completing the needs of the question. \$\endgroup\$ Dec 28, 2023 at 14:54
  • 1
    \$\begingroup\$ Stephen Elliott - Re: "I still do not have all parts of the question complete" Oh. OK. I have misunderstood. Please note that, just like on your question on the main site, "stream of consciousness" updating of the topic here is abnormal on Stack Exchange. It can hide whatever the main question is, making it hard or impossible to get help from other people, due to the amount of obsolete history it contains. FYI a question should not contain many "update" sections, but should be a single, coherent explanation of the question. Confusing questions may be closed. \$\endgroup\$
    – SamGibson Mod
    Dec 28, 2023 at 15:37
  • 3
    \$\begingroup\$ You really need to find out what a minimal reproducible example is. I'm amazed that at least one user took the time to read through several pages full of data dumps that could likely be summarized in a few concise examples. \$\endgroup\$
    – pipe
    Dec 29, 2023 at 10:08
  • \$\begingroup\$ I am happy to have answers to my questions for the three needed tables (and now I can get graphs also). It was a long process, but I needed a solution and thankfully I have one now. As for @pipe 's suggestion of a minimal reproducible example, I appreciate the advice. But after actually getting into it, it turns out that each case is actually different and one size does not fit all, but almost fits. As for posting this as an answer, I am still getting a -2 on the question that I considered fine. Why waste additional negative community feedback? Can someone better post the answer? \$\endgroup\$ Jan 1 at 12:01

1 Answer 1

1
\$\begingroup\$

The Stack Exchange Electronics formatted graphs for the x-axis, y-axis, and curve data are as follows:

X-axis Tabulated Values, Pixels, Volts, Math Model, and Relative Error:

pixel x pixel y \$x_{value} = -1.0*V_{DS} (Volts)\$ \$y_{value} = -1.0*I_{DS} (Amps)\$ \$10^{\left({\frac{x-199}{570-199}}\right)}\$ %Rel Error
199 553 1 0.3 1 0.00%
310 553 2 0.3 1.9915507353276 -0.42%
375 553 3 0.3 2.98121660134078 -0.63%
423 553 4 0.3 4.01581395812115 0.40%
458 553 5 0.3 4.99014548635398 -0.20%
487 553 6 0.3 5.97420778511007 -0.43%
513 553 7 0.3 7.0203891441092 0.29%
533 553 8 0.3 7.94821381907615 -0.65%
552 553 9 0.3 8.94298453606794 -0.63%
570 553 10 0.3 10 0.00%

Y-axis Tabulated Values, Pixels, Current, Math Model, and Relative Error:

The math model is given by manually fitting parameters from Shichman-Hodges equations, and the results are close to the experimental values in the graph, with its previously tabulated sample axis sample points previously tabulated.

Pixel-x Pixel-y \$ {X}_{-1.0*VDS(Volts)} \$ \$ {Y}_{-1.0*ID}(Amps) \$ \$ 10^{\left(\frac{(553-\text{y}_{pixel})}{(553-95)}*LOG_{10}(\frac{10}{0.3})\right)}*0.3\$ %Rel-Error
199 553 1 0.300000 0.300000 0.00%
199 516 1 0.400000 0.398243 -0.44%
199 487 1 0.500000 0.497251 -0.55%
199 461 1 0.600000 0.606774 1.13%
199 444 1 0.700000 0.691119 -1.27%
199 423 1 0.800000 0.811670 1.46%
199 409 1 0.900000 0.903504 0.39%
199 397 1 1.000000 0.990447 -0.96%
199 306 1 2.000000 1.987979 -0.60%
199 252 1 3.000000 3.005835 0.19%
199 216 1 4.000000 3.959747 -1.01%
199 186 1 5.000000 4.982179 -0.36%
199 162 1 6.000000 5.987159 -0.21%
199 142 1 7.000000 6.977857 -0.32%
199 125 1 8.000000 7.947822 -0.65%
199 108 1 9.000000 9.052618 0.58%
199 95 1 10.000000 10.000000 0.00%

X-Y Curve: X-Volts, Y-Current, Y-Modeled/Fitted and Slope \$\frac{ΔY}{ΔX}\$:

The math model is given by manually fitting parameters from Shichman-Hodges equations, and the results are close to the experimental values in the graph, with its previously tabulated sample axis sample points previously tabulated.

\$ X_{V\text{ }SD}\left(Volts\right)\$ \$Y_{I\text{ }SD}(Amps)\$ \$ I_{SD\text{ modeled}} \$ \$\frac{ΔY}{ΔX}\$
1.00000000 0.71261233 0.70234478 0.71261233
1.12515652 0.77522725 0.76905370 0.50029284
1.25814426 0.83691174 0.83474886 0.46383569
1.41560924 0.89661342 0.90561485 0.37914252
1.58292711 0.96057391 0.97267991 0.38226956
1.78104079 1.01345909 1.04109907 0.26694372
1.99155068 1.03700638 1.10071766 0.11185810
2.24080634 1.08575487 1.15384483 0.19557653
2.50565815 1.11098194 1.18949735 0.09524947
2.81925774 1.14553201 1.20392942 0.11017279
3.17210603 1.17214799 1.20527661 0.07543153
3.54703307 1.18115664 1.20670807 0.02402785
3.99096727 1.18115664 1.20840311 0.00000000
4.46267939 1.20860028 1.21020412 0.05817875
5.02121258 1.19938219 1.21233678 -0.01650394
5.61469460 1.20860028 1.21460271 0.01553207
6.31741047 1.19938219 1.21728575 -0.01311768
7.06409597 1.21788907 1.22013676 0.02478532
7.94821405 1.23668146 1.22351241 0.02125556
8.88765240 1.22724938 1.22709930 -0.01004023
10.00000000 1.24618614 1.23134637 0.01702422

For those wishing to copy and paste the X-axis, Y-axis, or X-Y curve axis sample points, below is the raw code to copy and paste as a reference:

Copy and Paste Code for Stack Exchange Electronics

X-axis Tabulated Values, Pixels, Volts, Math Model, and Relative Error:

|pixel x|pixel y|\$x_{value} = -1.0*V_{DS} (Volts)\$|\$y_{value} = -1.0*I_{DS} (Amps)\$|\$10^{\left({\frac{x-199}{570-199}}\right)}\$| %Rel Error|
|:-------:|:-------:|:------------------------:|:------:|:-----------:|:-------:|:----------:|
|199|553|1|0.3| 1 |0.00%|
|310|553|2|0.3|1.9915507353276|-0.42%|
|375|553|3|0.3|2.98121660134078|-0.63%|
|423|553|4|0.3|4.01581395812115|0.40%|
|458|553|5|0.3|4.99014548635398|-0.20%|
|487|553|6|0.3|5.97420778511007|-0.43%|
|513|553|7|0.3|7.0203891441092|0.29%|
|533|553|8|0.3|7.94821381907615|-0.65%|
|552|553|9|0.3|8.94298453606794|-0.63%|
|570|553|10|0.3|10|0.00%|

Y-axis Tabulated Values, Pixels, Current, Math Model, and Relative Error:

| Pixel-x | Pixel-y | \$ {X}_{-1.0*VDS(Volts)} \$ |\$ {Y}_{-1.0*ID}(Amps) \$ |\$ 10^{\left(\frac{(553-\text{y}_{pixel})}{(553-95)}*LOG_{10}(\frac{10}{0.3})\right)}*0.3\$ | %Rel-Error |
|:-------:|:-------:|:------------------------:|:----------------------:|:-----------------------------------------:|:----------:|
| 199 | 553 | 1 | 0.300000 | 0.300000 | 0.00% | 
| 199 | 516 | 1 | 0.400000 | 0.398243 | -0.44% | 
| 199 | 487 | 1 | 0.500000 | 0.497251 | -0.55% | 
| 199 | 461 | 1 | 0.600000 | 0.606774 | 1.13% | 
| 199 | 444 | 1 | 0.700000 | 0.691119 | -1.27% | 
| 199 | 423 | 1 | 0.800000 | 0.811670 | 1.46% | 
| 199 | 409 | 1 | 0.900000 | 0.903504 | 0.39% | 
| 199 | 397 | 1 | 1.000000 | 0.990447 | -0.96% | 
| 199 | 306 | 1 | 2.000000 | 1.987979 | -0.60% | 
| 199 | 252 | 1 | 3.000000 | 3.005835 | 0.19% | 
| 199 | 216 | 1 | 4.000000 | 3.959747 | -1.01% | 
| 199 | 186 | 1 | 5.000000 | 4.982179 | -0.36% | 
| 199 | 162 | 1 | 6.000000 | 5.987159 | -0.21% | 
| 199 | 142 | 1 | 7.000000 | 6.977857 | -0.32% | 
| 199 | 125 | 1 | 8.000000 | 7.947822 | -0.65% | 
| 199 | 108 | 1 | 9.000000 | 9.052618 | 0.58% | 
| 199 | 95 | 1 | 10.000000 | 10.000000 | 0.00% | 

X-Y Curve: X-Volts, Y-Current, Y-Modeled/Fitted and Slope \$\frac{ΔY}{ΔX}\$:

The math model is given by manually fitting parameters from Shichman-Hodges equations, and the results are close to the experimental values in the graph, with its previously tabulated sample axis sample points previously tabulated.

| \$ X_{V\text{ }SD}\left(Volts\right)\$ | \$Y_{I\text{ }SD}(Amps)\$ | \$ I_{SD\text{ modeled}}  \$ | \$\frac{ΔY}{ΔX}\$ |
|:------------:|:-----------:|:----------------------------:|:--:|
| 1.00000000 | 0.71261233 | 0.70234478 | 0.71261233 | 
| 1.12515652 | 0.77522725 | 0.76905370 | 0.50029284 | 
| 1.25814426 | 0.83691174 | 0.83474886 | 0.46383569 | 
| 1.41560924 | 0.89661342 | 0.90561485 | 0.37914252 | 
| 1.58292711 | 0.96057391 | 0.97267991 | 0.38226956 | 
| 1.78104079 | 1.01345909 | 1.04109907 | 0.26694372 | 
| 1.99155068 | 1.03700638 | 1.10071766 | 0.11185810 | 
| 2.24080634 | 1.08575487 | 1.15384483 | 0.19557653 | 
| 2.50565815 | 1.11098194 | 1.18949735 | 0.09524947 | 
| 2.81925774 | 1.14553201 | 1.20392942 | 0.11017279 | 
| 3.17210603 | 1.17214799 | 1.20527661 | 0.07543153 | 
| 3.54703307 | 1.18115664 | 1.20670807 | 0.02402785 | 
| 3.99096727 | 1.18115664 | 1.20840311 | 0.00000000 | 
| 4.46267939 | 1.20860028 | 1.21020412 | 0.05817875 | 
| 5.02121258 | 1.19938219 | 1.21233678 | -0.01650394 | 
| 5.61469460 | 1.20860028 | 1.21460271 | 0.01553207 | 
| 6.31741047 | 1.19938219 | 1.21728575 | -0.01311768 | 
| 7.06409597 | 1.21788907 | 1.22013676 | 0.02478532 | 
| 7.94821405 | 1.23668146 | 1.22351241 | 0.02125556 | 
| 8.88765240 | 1.22724938 | 1.22709930 | -0.01004023 | 
| 10.00000000 | 1.24618614 | 1.23134637 | 0.01702422 | 
\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .