|
From: | Farzad Torabi |
Subject: | Re: How to call a function that is in another file? |
Date: | Mon, 23 Dec 2019 22:36:50 +0100 |
The first line in the text csv file must be 'sep=;' or 'sep=,'.This line defines the separator to be considered in the read function...Attached you may find a csv starting with 'sep=;'.Of course, using 'search'/'replace all' you may change ';' to ',' or vice versa.The command is:abc=load_csv("D:\\E\\Em\\Workspace-Octave\\Interpolari\\00001Alpha\\alphaXYinp.csv",";")orabc=load_csv("D:\\E\\Em\\Workspace-Octave\\Interpolari\\00001Alpha\\alphaXYinp.csv",",")On Sunday, November 17, 2019, 3:52:55 PM GMT+2, Farzad Torabi <address@hidden> wrote:Thank you very much EmilI didtest=load_csv('test.csv' , "," )but it didn't work , shall you please help me with the syntax I need to use ?On Wed, Nov 13, 2019 at 6:36 PM Emil M. Oanta <address@hidden> wrote:A computer code line in GNU Octave ends with either ';' semicolumn or nothing.Semicolumn means that the result is not displayed.I learnt that csv may be correctly read in Excel if the first line in the TEXT csv file specifies the symbol use to separate the values.For 'comma' it is 'sep=,', but this is the default separator.For 'semicolumn' it is 'sep=;', which is used when the decimal point is actually a comma, ','.I send you my code which loads a csv file in a double type matrix which is returned to the upper level.I use this original code in a set of upper level codes, please see figure 3 in https://iopscience.iop.org/article/10.1088/1757-899X/591/1/012061/pdfYou may modify it to return a matrix of strings, which may be processed in the upper level.EmilOn Wednesday, November 13, 2019, 3:12:14 PM GMT+2, Farzad Torabi <address@hidden> wrote:well I think I have some problems that start with reading from input .csv files , but I have them also when I input them manually instead of reading from csv. first I noted the ; semicolon is causing problem to read a row and put it in a matrix (list ) like test1= [1, 100, 200, 300]if I try to change the semicolon to comma then I get the error:error: load: unable to determine file format of 'test.csv'but then even when I input the test matrix manually and then ran the function that included this data as input:result = myfunc(input1,input2, test1]error: 'result' undefined near line 1 column 1So I don't know whether I am not using the function calling correctly, or it's a formatting problem or what ...On Wed, Nov 13, 2019 at 11:06 AM Emil M. Oanta <address@hidden> wrote:Hi,Try to trace the execution by printing some messages from the files/functions.If you place a message in an if (echo > 0) ... you can activate and deactivate messages using 'echo'.If the line is finished by ; there are no answers regarding the result of that line of the program.EmilOn Tuesday, November 12, 2019, 5:33:08 PM GMT+2, Doug Stewart <address@hidden> wrote:On Tue, Nov 12, 2019 at 10:09 AM Farzad Torabi <address@hidden> wrote:Hi AllI have several files in a folder that each of them is a function and each one should call the other file.there is no Main.py constructed , so I need to call the main function from command prompt , but when I type the function name with its inputs, I don't get any output since it seems like first the function mfile should be loaded. How do I do that ?--
If you don't get an error message then the function was run.Perhaps the function does not display any data?------
[Prev in Thread] | Current Thread | [Next in Thread] |