Programing questions about Spreadsheet App and PRINT.
|
11-22-2014, 04:46 PM
(This post was last modified: 11-22-2014 05:30 PM by rbiondi.)
Post: #1
|
|||
|
|||
Programing questions about Spreadsheet App and PRINT.
Hello,
I'm writing an application for my HP Prime and need some help. Do you know how may I get the following information from a Spreadsheet of Prime, programmatically? - The name of the column. I've tried Cell(0,i) but didn't work. - The number of filled rows and columns (row and column count)? - Other question is if is possible clearing the screen after using several PRINT commands. Thank you very much for your help, Rogerio |
|||
11-22-2014, 05:36 PM
Post: #2
|
|||
|
|||
RE: Get information of Spreadsheet App in a program.
Use the cell location as a variable name.
You can use the cell name variable in functions and commands. (Say, cell B2 contains 62.5, then): Example: Enter f(x):=x^2; Enter f(b2) ---> 3906.25 -or- Enter f(B2) ---> 3906.25 |
|||
11-22-2014, 05:38 PM
Post: #3
|
|||
|
|||
RE: Programing questions about Spreadsheet App and PRINT.
You can clear the print screen with nothing in the parens:
PRINT(); |
|||
11-22-2014, 05:40 PM
Post: #4
|
|||
|
|||
RE: Programing questions about Spreadsheet App and PRINT.
Thank you for reply. I'm trying to get the column names. For example, if I set the name of A column to "Temperature" in the Spreadsheet App, I'd like to get the name of that column in my program.
Best regards, Rogerio |
|||
11-22-2014, 05:47 PM
(This post was last modified: 11-22-2014 05:55 PM by DrD.)
Post: #5
|
|||
|
|||
RE: Programing questions about Spreadsheet App and PRINT.
Per the USER GUIDE: Page 192 Chapter 10 Spreadsheet
Using names in calculations The name you give a cell, row, or column can be used in a formula. For example, if you name a cell TOTAL, you could enter in another cell the formula =TOTAL*1.1. IF column A is named "Temp" then Temp1 refers to the first cell in that column, and temp2 the second cell, etc.: Temp1 has 32 Temp2 has 4 Temp1 * Temp2 ---> 128 |
|||
11-22-2014, 06:16 PM
Post: #6
|
|||
|
|||
RE: Programing questions about Spreadsheet App and PRINT.
(11-22-2014 04:46 PM)rbiondi Wrote: Hello, 1. There is currently no means (that I know of) to extract the name of a column if you've renamed it in the Spreadsheet app. Here's hoping something like A0, B0, etc will be allowed for reference to column names in future firmwares. 2. For this, the best you can do is to use (in Home screen): count("x->(x<>0)", A1:A5) and it will count the number of non-zero cells (similar to Microsoft's Excel). However, this is not a perfect solution since empty cells are considered to be filled with 0 (even if they physically are empty in the Spreadsheet). So this will miscount if you have an actual cell with value 0. Perhaps the devs will provide an actual COUNT, COUNTA, COUNTIF, and COUNTBLANK commands similar to those in Excel. 3. Typing PRINT() with no arguments should clear the screen. Graph 3D | QPI | SolveSys |
|||
11-22-2014, 07:05 PM
Post: #7
|
|||
|
|||
RE: Programing questions about Spreadsheet App and PRINT.
(11-22-2014 04:46 PM)rbiondi Wrote: - The name of the column. I've tried Cell(0,i) but didn't work.You can access a row with the syntax A:A and SIZE(A:A) returns the number of values in the first column. I couldn't find a way to access the column name, just the names of single cells can be accessed with A1(2). A1(-1) returns a list with attributes for a cell, A:A(-1) the same for the first column as a list of lists. (cf. Help->HP Apps->Spreadsheet->Spreadsheet Variables->Cell References and Cell.) There seems to be bug in the Cell function: The notation Cell(1,1,n) works well while Cell(0,1,n) or Cell(0,0,n) seems to return 0 in any case. Marcus von Cube Wehrheim, Germany http://www.mvcsys.de http://wp34s.sf.net http://mvcsys.de/doc/basic-compare.html |
|||
11-22-2014, 07:49 PM
Post: #8
|
|||
|
|||
RE: Programing questions about Spreadsheet App and PRINT.
(11-22-2014 07:05 PM)Marcus von Cube Wrote: You can access a row with the syntax A:A and SIZE(A:A) returns the number of values in the first column. Very cool (need to write this down for my own benefit), but there seems to be something odd with this. If column A has cells 1 through 3 filled, and column B is blank, then B:B returns {0,0,0}. The behavior seems to suggest that this gives you a list whose size is the size of the longest column, and all other columns are internally filled with 0 where needed to form a similarly sized column. (The same goes for rows using $2:$2 to refer to row 2) Quote:I couldn't find a way to access the column name, just the names of single cells can be accessed with A1(2). A1(-1) returns a list with attributes for a cell, A:A(-1) the same for the first column as a list of lists. (cf. Help->HP Apps->Spreadsheet->Spreadsheet Variables->Cell References and Cell.) I was not familiar with the Cell(x,y,z) notation. It seems that Cell(1,2,3) is equivalent to A2(3). I think that Cell(x,y,n) where x=0 or y=0 doesn't return anything because there's no corresponding row 0 or column 0. For example, Cell(1,2) is the same as A2. So Cell(0,1) would refer to column 0 and row 1 (which isn't a valid cell). Maybe one of the developers can weigh in on this. Graph 3D | QPI | SolveSys |
|||
11-23-2014, 09:42 AM
Post: #9
|
|||
|
|||
RE: Programing questions about Spreadsheet App and PRINT.
(11-22-2014 07:49 PM)Han Wrote: I think that Cell(x,y,n) where x=0 or y=0 doesn't return anything because there's no corresponding row 0 or column 0. For example, Cell(1,2) is the same as A2. So Cell(0,1) would refer to column 0 and row 1 (which isn't a valid cell). Maybe one of the developers can weigh in on this. According to the help, Cell(0,col) should return the complete column but all I get is 0. Marcus von Cube Wehrheim, Germany http://www.mvcsys.de http://wp34s.sf.net http://mvcsys.de/doc/basic-compare.html |
|||
11-23-2014, 10:59 PM
Post: #10
|
|||
|
|||
RE: Programing questions about Spreadsheet App and PRINT.
Thank you very much for your help, guys.
I just wrote an App for creating decision trees (ID3 algorithm) based on spreadsheet data, that's why would be great having the title of the colums, for user does not having to define them on the setup phase. As soon as I've tested, l finished and polished, will be submitted to hpcalc.org. It's getting nice and easy to use and you can "mine" a few lines in order to inference some quick rules from data. Just bought my Prime Calculator last week and don't know well how it works, just learning. I'm having several issues with connectivity kit, the emulator and the actual calculator. Had to change from my home locale (pt_Br) to English due to the comma that is not recognized in the program, instabilities and other issues. The emulator firmware is older than the calculator (7/2014). Best regards, Rogerio |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)