Creatin a matrix within values from a biger matrix

조회 수: 3 (최근 30일)
Camilo Jurado Paez
Camilo Jurado Paez 2021년 3월 5일
답변: Prudhvi Peddagoni 2021년 3월 8일
I have a matrix 500000x117. I need to populate a matrix 7x116 with values from the bigger matrix (1:7,2:117)
  댓글 수: 3
Camilo Jurado Paez
Camilo Jurado Paez 2021년 3월 5일
편집: dpb 2021년 3월 5일
I'm having problems when I read a spreadsheet from excel. It's a cell array and I dont know wy Im having an error whenever I try to convert it to a matrix
opts = spreadsheetImportOptions("NumVariables", 117);
m_test = readmatrix("C:\Users\Camilo\Desktop\data_raw_sample.xlsx",...
opts, "UseExcel", false);
m1 = zeros(length(m_test(:,2:117)));
mtom1 = m_test(1:7,2:117);
mf = cell2mat(mtom1);
Thank you so much
dpb
dpb 2021년 3월 5일
Well, we'd have to see the form of the data in the spreadsheet and the error message but readmatrix doesn't return a cell arry; it returns a double array already -- any data in the spreadsheet that can't be interpreted as a valid floating point number will be returned as NaN.
m=readmatrix("C:\Users\Camilo\Desktop\data_raw_sample.xlsx");
m1=m(1:7,2:117);
will return the content of whatever is in the spreadsheet that is numberic in that region of the overall array; as noted, if some of the content of the file is non-numeric, those will be returned as NaN--but still in a double array.

댓글을 달려면 로그인하십시오.

답변 (1개)

Prudhvi Peddagoni
Prudhvi Peddagoni 2021년 3월 8일
Hi,
you can use import tool to import data from the spreadsheets. You can check if there are any NaN values too.
Hope this helps.

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by