run function in function [closed] - function

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I'm new to Octave and I've a script that work in matlab that have following structure :
function []=myFunctionName()
...
a='path';
b=2;
c=5
d='x';
[x,y]=lecFunc(a,b,c,d);
plot(x,y);
...
function [k,t]=lecFunc(pt, nF, nS, val)
....
fid=fopen(pt,'r');
k=fread(fid,[1,N],'real*4');fclose(fid);
t=linspace(tmin,tmax,nt);
etc ...
And I get the error :
error: 'lecFunc' undefined near line 141 column 10
I couldn't understand why... I try to seprate the functions with endfunction and also put the function lecFunc at the top, but it still not work...
Could someone help me to understand this difference between matlab and octave ?
Thanks a lot !

You use lecFunc in myFunctionName. Try to define lecFunc before defining myFunctionName

Related

Exception of 50000 characters at 'SpreadsheetApp.flush()' in Google Sheets? [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
I'm trying to import a list from my Gmail into a spreadsheet.
It has worked flawlessly several times, but I decided to do some cosmetic changes and now I get a baffling error:
var l = artikelen.length; //l = 40 in this case
var importSh = SpreadsheetApp.getActive().getSheetByName("import");
var range = importSh.getRange(2,1,l,1);
range.setBackground("#ab6e6e");
SpreadsheetApp.flush(); //throws error 'Input exceeds the limit of 50000 characters in a cel'
What is that? I'm not trying to put anything in a cell?? I'm just ordering to pick a range and set a colour AFAIK. Which in fact is not executed either...
What am I overlooking here?
Any suggestion will be welcome.
The culprit may be elsewhere in your code. Chances are that there is an attempt to put more than 50,000 characters in some cell.
Spreadsheet writes are lazy, and the error may only get shown when the script terminates, or at flush(), as the case seems to be here. To debug, add a flush() after every Range.setValues() and Range.setValue() call. Use console.log() to find what the values you are writing look like.

Erlang store file contents in a list [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
code
read_CNF_File(FileName)->
case file:read_file(FileName) of
{ok, Data} -> print(binary:split(Data, [<<"\n">>], [global]));
{error, Reason} -> Reason end.
print([]) -> ok;
print([L|List]) ->
L,
print(List).
[Pic Related] How do I store contents from a file into a list (ideally a list of every line), if I try to io:fwrite As in read_CNF_File it seems to store it the way I want, however once I try to call print with that it just passes As as an empty list, thanks.
It is your print function that does nothing.
If you pass it à non empty list, it removes the first element (A in your code), the statement A, does nothing, and then recursively call itself with the tail of the list, until it is empty a' finally returns OK.

invalid command name in TCL [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
invalid command name "if{0}{"
Giving me an error, for that I have find how many cell in the file.
Where am I making a mistake?
Update::::::::::::::::::::::::::::::::::::::::::::::::::::::::
I am having an issue while sorting an array...
It says
enter image description here
Since the last element is integer, still it says "expected integer but got...
Where am i making mistake?
You must place a space between 'if' and the opening brace.
Basicly, the Tcl interpreter tokenizes commands by searching for whitespace, while at the same time substituting stuff inside []. So first, the regexpr is evaluated, yieling 0 and togehter with the remaining characters this yields the command name.

How to write a function output into .txt file? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have to write a function that produces random(parameter) integers i have to write random output of this funtion into .txt file. Also i have to find max and min integers from this function (write them into .txt too)
I cant find any tutorial about this subject. Want to use "a+" as writer.
Firstly, please have a look online for tutorials on how to write to a file. There are loads of free resources online.
You have already done a lot of the work and only needed few more lines
import random
def createRandomNumberFile(min, max, count, outputFileName):
outputFile = open(outputFileName, 'a+')
for item in range(0, count):
randomNumber = random.randint(min,max)
outputFile.write(randomNumber)
outputFile.close
Explanation - As you have assigned the file using the 'a+' mode (appending mode) to a variable (outputFile) you can simply use this variable to write to the file and then later close file (closing the file isn't always necessary but is good practice).
Hope that helps

Remove element from JSON object by value [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I have the next JSON object
console.log:
Object {0: "/files/f6/bd/05/a9/medium/f6bd05a970c63b77eae164a607441818.jpeg",
1: "/files/ff/54/e3/17/medium/ff54e317d47631661eafeec6638ec530.jpeg",
2: "/files/b3/27/63/17/medium/b3276317020322ef77ac39447075286e.jpeg"}
And I need to remove element from this object by this string:
/files/f6/bd/05/a9/medium/f6bd05a970c63b77eae164a607441818.jpeg
I read a plenty of solutions for this question but all of them was about object with not numeric indexes. I use jQuery for it.
Please help me with function for my trouble. Thanks in advance.
Iterate through the object to find the value and delete the key once found:
// Assuming your object is called "foo":
for ( var k in foo ) {
if (foo.hasOwnProperty(k)) {
if (foo[k] === '/files/f6/bd/05/a9/medium/f6bd05a970c63b77eae164a607441818.jpeg') {
delete foo[k];
}
}
}
console.log(foo);