Hi
I have a problem, my xlxs is A:N and it has 489 rows. I can import data form xlsx to matlab as a table or as a dobule. What should i do next to do it as quick as posible to plot it?

 Accepted Answer

Star Strider
Star Strider on 16 Sep 2017

0 votes

I would use the xlsread funciton (preferably) to read it to a matrix, or the readtable function to read it to a table. Your resulting matrix will be (489x14), so the plot of it may be difficult to interpret.

2 Comments

ok i did it like this dane = readtable('a.xlsx');
and got dane as 4848x14 it is ok then take like this x=dane(:,1); y1=dane(:,2); y2=dane(:,3);
and each data is in table
but how to take it from table to double
when i did table2array i got each data as cell not as duble why?
First, I would not create separate ‘dynamic’ variables for each column. That is poor and inefficient programming practice. Please simply use the column references such as ‘dane(:,1)’, ‘dane(:,2)’ and so for the rest of the columns in your code.
Second, you can create a double array from your matrix by nesting your table2array call inside a cell2mat call:
dane_double = cell2mat(table2array(dane));
That should work in your code. (Name it something more convenient to type than ‘dare_double’. I named it that for clarity.)

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!