Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. public float modelPredict(String StationNM, int day, int hour, int minute) {
  2. int[] model = new int[0];
  3. try {
  4. File csvfile = new File(Environment.getExternalStorageDirectory() + "/"+StationNM+".csv");
  5. CSVReader reader = new CSVReader(new FileReader("csvfile.getAbsolutePath()"));
  6. // CSVReader reader = new CSVReader(new FileReader(StationNM+".csv"));
  7. String[] nextLine;
  8. while ((nextLine = reader.readNext()) != null) {
  9. // nextLine[] is an array of values from the line
  10. System.out.println(nextLine[0] + nextLine[1] + "etc...");
  11. }
  12. model = new int[nextLine.length];
  13. for (int i=0; i<nextLine.length; i++) {
  14. model[i] = Integer.parseInt(nextLine[i]);
  15. }
  16. } catch (Exception e) {
  17. e.printStackTrace();
  18. //Toast.makeText(this, "The specified file was not found", T oast.LENGTH_SHORT).show();
  19. }
  20.  
  21. /System.err: java.io.FileNotFoundException: csvfile.getAbsolutePath() (No such file or directory)
  22. at java.io.FileInputStream.open0(Native Method)
  23. at java.io.FileInputStream.open(FileInputStream.java:231)
  24. at java.io.FileInputStream.<init>(FileInputStream.java:165)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement