i cannot upload the response file(excel) ; its fine while uploading the predictor

1 次查看(过去 30 天)
function [newData1] = importfile(fileToRead1)
%IMPORTFILE(FILETOREAD1)
% Imports data from the specified file
% FILETOREAD1: file to read
% Auto-generated by MATLAB on 17-Mar-2022 21:31:45
% Import the file
sheetName='Sheet1';
[numbers, strings, raw] = xlsread(fileToRead1, sheetName); %#ok<XLSRD>
if ~isempty(numbers)
newData1.data = numbers;
end
if ~isempty(strings)
newData1.textdata = strings;
end
if ~isempty(strings) && ~isempty(numbers)
[strRows, strCols] = size(strings);
[numRows, numCols] = size(numbers);
likelyRow = size(raw,1) - numRows;
% Break the data up into a new structure with one field per column.
if strCols == numCols && likelyRow > 0 && strRows >= likelyRow
newData1.colheaders = strings(likelyRow, :);
end
end

回答(1 个)

Dinesh
Dinesh 2023-12-22
Hello.
The issue is that the Excel file you're trying to upload as a response isn't being accepted, possibly due to the file size or format limitations (inferred from your code). This can occur if the upload mechanism doesn't support the specific Excel file size or if the file format isn't recognized by the system's configuration. To resolve this, ensure the file conforms to size limits, check for the correct file format, and verify that your system has the appropriate permissions set for the file upload.
If needed, here's a code snippet for checking file size before attempting the upload in MATLAB:
fileInfo = dir(fileToRead1);
if fileInfo.bytes < uploadLimitBytes
% Proceed with file upload
else
error('File exceeds the maximum allowed size for upload.');
end
The following links might help you:

Community Treasure Hunt

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

Start Hunting!

Translated by