Unrecognized function or variable - function

I'm trying to run the beginning of a script that was sent to me:
function [ FList ] = ReadFileNames(DataFolder)
DirContents=dir(DataFolder);
FList=[];
DataFolder is the name of the folder in which all my data is held. When I click the Run button I receive:
ReadFileNames(DataFolder)
Unrecognized function or variable 'DataFolder'.
And I'm not sure why?
Any help is much appreciated. Thank you.

When you simply click Run, it's the same as running the command
ReadFileNames();
Note there are no inputs here, but your code expects (and requires) the input DataFolder.
So you have to do one of two things
Click the drop-down by the Run button, edit the type code to run prompt and add your folder. Then you can continue to click the Run button to execute this again. Note that once you've edited the default Run command for a function, the Run button icon changes slightly to reflect it:
A more common, and arguably more clear, way to run your function would just be to call it from the Command Window by typing ReadFileNames('your/folder/path/here'); (and hitting Enter to run).

Related

Octave GUI: right-click and edit function in a script file

In the Editor window of Octave GUI, if I right click on a function (say, f1) in an expression where it is called, and "Edit f1", function file f1.m opens.
But if my function (now plot_color_marker_ranges) is defined in a script file instead of a function file, when I right-click in an expression where it is called (1) and "Edit" (2) I get the following message
(1)
(2)
Can I get hyperlinking and navigation when a function is defined in a script file instead of a function file?
Steps to reproduce
Create script file myscript.m containing a function f1.
This script file has as its first command 1;.
Create script file mymain.m, and add an expression that calls f1.
Add also source('myscript.m') above the first call to f1.
This script is in the same directory as myscript.m.
At this point, both files were saved on disk.
Run mymain.m from the Editor window of Octave GUI to make sure f1 is correctly used from mymain.
Navigate in the Editor window of Octave GUI to the expression that uses f1.
Right click on any part of the text "f1".
Click on "Edit f1".
EDIT:
Notes:
This helps a lot with editing and debugging.
As of now, whenever I need to debug I set an M-file for the functions. Then I may transfer the function to a script file.
Using Octave 5.1.0 configured for mingw32 under Win 10.

Invoking series of commands in a new tab in cmder

TLDR:
I want to use something like -new_console:t:tabname to open a new named tab in cmder and then transfer focus/control to that tab so that the rest of the commands I'm sending from a Python script run in that console instead. Or, I want to rename a cmder tab from a script running in the console.
DETAILS:
I often have to execute a series of commands in cmder in order to test the latest code from our continuous integration environment. Because there are several applications I often have to have running at a time, it would be helpful for me to have the cmder tabs named according to which application they are running.
The only way I've found to set a tab name from within cmder (apart from manually with mouse clicks) is to do so with the -new_console:t:tab_name command. But that only runs the next command in the newly opened tab, and not all the things that come after it.
I kick off all my commands with a Python script that accepts parameters to let me control which application opens and how things behave. I'd like to do something like this:
os.system('pwd "-new-console:t:' + args.app + '"')
so that a new tab opens with the name of the app I'm about to invoke in it, starting with an indication of the present working directory. But then I'd like all the commands that follow from the Python script to be run in this new tab instead of in the tab used to kick off the Python script. This includes printing some flowerboxed comments, but also invoking a local application server that will continue running.
Is there any way to, as you create a new (named) tab in cmder, transfer focus to that tab so that all future commands run in that tab instead of the initiating tab? Alternately, is there any way from within a cmder console to rename the cmder tab it's running in? That would be just as good.
Thanks!
Thanks for looking, but I found the answer.
In the bottom right corner is a hamburger stack. Click on that and select Settings. In General --> Tab bar, change the Console setting from the default %n to %s. Then the "title" command will change the tab name.

PHPstorm console input not working during debug sessions

I'm using a PHP script which expects user input from a command like fgets(STDIN). The problem is it no longer works in the newest version of PHPStorm (10).
The same works when I run it directly (without debugger enabled) and anything I enter in the console is sent to the script (on direct run).
But during a debug session, when I try to input text at the script's prompt, it does not go to the script. My best guess is that the new REPL feature is overriding user input in console during debugging. I say this because pressing the UP/DOWN arrows opens up a popup with all PHP function names.
It used to work correctly with last version.
How can I send user input to my PHP script with this new version? Am I missing something here?
I'm not sure if this is the same thing, but I was running into this same problem, and I was able to get it working by deselecting the "Use Console Input" checkbox in the PHPStorm Console.
John's answer is perfect.
I want to mention that the Use Console Input is a tiny icon in sidebar of the debug console. I provide you by this image

Octave input from keyboard not working in a script

I'm writing a script in octave that needs an input from keyboard in order to select a function to be used further. I've read the documentation and understood that
ans = input("choose...")
should wait for the for the input and store it in the ans variable. When I use it in the octave terminal it works just fine, but it doesn't when I insert it in my script : It shows the message "choose..." but it doesn't wait.
I don't get it, What I am missing.
Thanks,

How to execute rrdcgi script from command line?

I have some rrdcgi scripts with HTML code which are used to show graphs on my webpage. When I try to run this script from webpage its fine and showing all details perfectly but when i execute this script from command line it shows below error and never returned to command line.
(offline mode: enter name=value pairs on standard input)
Can you please suggest me how can i execute these scripts from command line?
I have got the answer to pass null values in the script i.e.
./script.cgi < /dev/null
It solves my issue.
Look here. The page is really big, so just scroll down until you see (offline mode: enter name=value pairs on standard input) in a code example.