Why xlsread() not reading some data
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
okoth ochola
el 1 de Sept. de 2023
Respondida: Dyuman Joshi
el 1 de Sept. de 2023
Hi, I have been trying to read data from excell to matlab, I wanted to program it such that i have more freedom on how to import and do my anaylsis faster. So i had the following code below. I noticed that the functions works well for large data say 10000 by 24. But when i try to import execll sheets with only one or to columns am running into errors. I have attached the error messsage as well. Iyt say the range is invalid yet, data is well present in the sleced cells. Please assist anybody who might have a knowledge of what is going on.
Filepath1=input('Enter the file path to the excel workbook where your wind data (direction and speed data) is stored\n');
Sheetnumber3=input('enter the sheet number conntaining the Time(month and year) vector whose elements are the\n month and year in cosecutive columns say A(month) and B(year) corresponding to each wind speed entry\n');
Cell31=input('Enterthe cell number of the first entry in months column vector data entry in excell sheet e.g A1\n');
Cell32=input('Enter the cell number of the last entry in months column vector in excell sheet e.g B32\n');
Range3=Cell31:Cell32;
Month_data = xlsread(Filepath1,Sheetnumber3,Range3)
Below is my inputs and the error message am getting. I swear the cells chosen have data entries. However for data enetry with 10000 by 24 is being imported succesfully by the same code. Am using matlab2018a
>> clear
>> rtrtrt
Enter the file path to the excel workbook where your wind data (direction and speed data) is stored
'C:\Users\hp\Desktop\MScResearchFolder\WindspeedData-Narokstation.xlsx'
enter the sheet number conntaining the Time(month and year) vector whose elements are the
month and year in cosecutive columns say A(month) and B(year) corresponding to each wind speed entry
3
Enterthe cell number of the first entry in months column vector data entry in excell sheet e.g A1
'D1'
Enter the cell number of the last entry in months column vector in excell sheet e.g B32
'E96432'
Warning: Colon operands must be real scalars.
> In rtrtrt (line 5)
Error using xlsread (line 260)
Data range 'DE' is invalid.
Error in rtrtrt (line 6)
Month_data = xlsread(Filepath1,Sheetnumber3,Range3)
>>
0 comentarios
Respuesta aceptada
Dyuman Joshi
el 1 de Sept. de 2023
Cell31 = 'D1';
Cell32 = 'E96432';
Range3=Cell31:Cell32
What you want to do is this -
Range3 = [Cell31 ':' Cell32]
%another way
Range3 = sprintf('%s:%s', Cell31, Cell32)
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Import from MATLAB en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!