Version: 1.6.0 (using KDE 3.5.3) Installed from: Compiled From Sources OS: Linux I try to load a matrix form a source file through KstScript, but Kst fails to load the matrix properly. Data Manager shows that the matrix I just loaded only has 1 sample and ranges from 0 to 0, which is certainly not the case. Here are the command lines: kst> source = new DataSource("/home/vyiwen/datafiles/asciimatrix.txt"); DataSource kst> mx = new Matrix(source, "3"); Matrix
Created attachment 23487 [details] This is the source file for loading matrix in the problem desciption above.
This is because javaScript does not provide functionality for the configuration settings of a datasource.
This functionality could be added for each datasource - but for every datasource providing a custom configuration dialog the corresponding functionality would need to be added to javaScript. A better, though initially more complex, scheme would be to provide a mechanism whereby javaScript can discover the configurable settings of a datasource.
SVN commit 775083 by arwalker: CCBUG:157472 start to add custom configuration for a datasource M +18 -3 kstdatasource.cpp M +7 -0 kstdatasource.h WebSVN link: http://websvn.kde.org/?view=rev&revision=775083
SVN commit 775086 by arwalker: CCBUG:157472 continue to add custom configuration for a datasource M +125 -32 ascii.cpp M +2 -0 ascii.h WebSVN link: http://websvn.kde.org/?view=rev&revision=775086
SVN commit 775089 by arwalker: CCBUG:157472 continue to add custom configuration for a datasource M +104 -2 bind_datasource.cpp M +26 -0 bind_datasource.h M +6 -1 bind_matrix.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=775089
javaScript now has sufficient functionality to read matrices from an ascii data source. The script would look something like: ds=new DataSource("\root\asciimatrix.txt") ds.setConfiguration("dataStartLine","1") ds.setConfiguration("readFieldNames","true") ds.setConfiguration("readFieldNamesLine","0") ds.reset() m=new DataMatrix(ds, "[Matrix,50,0,0,0.5,0.5]") NOTES: You must use a DataMatrix, as a Matrix is simply a static matrix that is not connected to a data source. The call to reset() is essential as it tells the data source to reparse the data file after the configuration settings have been changed. The text identifying the matrix "[Matrix,50,0,0,0.5,0.5]" must match exactly with the text in the data file.
Need to update documentation
Loading can be made slightly easier using (for example): m=new DataMatrix(ds, ds.matrixList()[0]) or even simpler: m=new DataMatrix(ds, 0)
fixed in 1.6.0 documentation