I need to write a program that allows the user to pick one o

I need to write a program that allows the user to pick one of the ten design project\'s excel files, import it (using xlsread) and break into vectors.

I have the ten design project\'s excel files, but I don\'t know how to write the program.

Can you help me please?

Here is how that data look like. All the ten files have the same idea, but with different numbers.

File Home Insert Page Layout Formulas Data Review View Aspen AS Cut Calibri Wrap Text Paste Merge & Cent: Format Painter Clipboard Font Alignment A2 47.2373714 1 Latitude Longitude Elevation Distance HR (bpm) Speed (m/s) 375.8 375.8 375.8 376.8 376.8 0 2 47.23737 88.489 3 47.23732 88.489 4 47.23727-88.489 5 47.23706-88.4891 6 47.23698 88.4892 7 47.23689-88.4892 8 47.2368-88.4892 9 47.2367288.4892 10 47.23663-88.4892 11 47.23653-88.4892 12 47.23645-88.4893 13 47.2364 -88.4893 14 47.23636-88.4894 15 47.23636-88.4894 16 47.23638-88.4894 0 3.553 5.095 0 8.101001 0 8.881001 9.369 0 9.745001 9.31 09.789001 9.809 9.085 7.402 5.759 3.842 3.868 0 6.19 12.09 36.11 45.5 377 377.2 377.2 377.2 377.4 377.8 104.46 377.6 111.51 377.2 376.4 120.64 375.6 124.63 55.25 65.32 74.63 84.89 95.38 0 0

Solution

Excel Reading and Writing By using Java:

Java provides classes which supports to read and write micro soft excel files. For that you need to download and configure a jar file named jxl.jar file. This jar file supports read and write operation on excel work book through java program.

In eclipse ide right clikc on the project, go to build path, configure build path and add excetnal jar files select jxl.jar from your local computer. then the below program is works other wise Cell,sheet , number and other classes are not resolved and thorows an error mesages.

import java.io.File;
import java.io.IOException;

import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;

import jxl.read.biff.BiffException;

import jxl.write.Label;
import jxl.write.Number;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
import java.util.Scanner;


public class ReadWriteExcel {
   {
           public static void main(String[] args)throws Exception
                              {
              //create a work book
              WritableWorkbook workbook;
              //output the data in xls
              workbook = Workbook.createWorkbook(new File(\"output.xls\"));
              //create a work sheet in workbok
              WritableSheet wsheet = workbook.createSheet(\"First Sheet\", 0);
              //create headings
              Label label = new Label(A, 1, \"Latitude\");
              Label label2 = new Label(A,2,\"Longitude\");
              Label label3 = new Label(A,3,\"Elevation\");
              Label label4 = new Label(A,4,\"Distance\");
              Label label5 = new Label(A,5,\"HR(bpm)\");
              Label label6 = new Label(A,6,\"Speed(m/s)\");
              //adding the heading to sheet            
              wsheet.addCell(label);
              wsheet.addCell(label2);
              wsheet.addCell(label3);
              wsheet.addCell(label4);
              wsheet.addCell(label5);
              wsheet.addCell(label6);
            
              Scanner sr = new Scanner(System.in);
            
              Number number = new Number();
              number = sr.next().parseFloat();
              wsheet.addCell(number);
              wworkbook.write();
              wworkbook.close();

              Workbook workbook = Workbook.getWorkbook(new File(\"output.xls\"));
              Sheet sheet = workbook.getSheet(0);
               Cell cell= new Cell();
               for(int i=0;i<=sheet.getColumns();i++){
                  for(int j=0;j<=sheet.getRows();j++){
                   cell=sheet.getCell(i, j);
               }
               }
           
              System.out.println(cell.getContents());
              workbook.close();
           }
       }

}

The above program createa a facility to read and write data to excell sheet.

I need to write a program that allows the user to pick one of the ten design project\'s excel files, import it (using xlsread) and break into vectors. I have th
I need to write a program that allows the user to pick one of the ten design project\'s excel files, import it (using xlsread) and break into vectors. I have th

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site