Error can't load mat file from script, while manual loading is not an issue
古いコメントを表示
I've been trying to load a .mat file through a script and even used the generate script function again to see if I made any coding errors.
When I load it manually via the import data button it works fine.
However when I try to load it through a script (even matlabs own generated script) then it throws out the following error:
Error using load
Unable to read MAT-file C:\Users\vdvoor45\OneDrive -
imec\Lumerical\Pix4Life_simulations\Fluorescence_nanopore_WG_coupling\Clean_NP_in_WG_with_dipole\Mesh_convergence_tests\Output_Files_converge_X_disttoPML\WG0001_Trans_and_Purcell_mpar_1_mval_1_waterSub_x0_y0_z0_NPdia50_WL640_660.mat.
Not a binary MAT-file. Try load -ASCII to read as text.
This is matlab's generated script when manually importing this EXACT SAME FILE
function importfile(fileToRead1)
%IMPORTFILE(FILETOREAD1)
% Imports data from the specified file
% FILETOREAD1: file to read
% Auto-generated by MATLAB on 28-Mar-2019 18:01:45
% Import the file
newData1 = load('-mat', fileToRead1);
% Create new variables in the base workspace from those fields.
vars = fieldnames(newData1);
for i = 1:length(vars)
assignin('base', vars{i}, newData1.(vars{i}));
end
This script still throws the exact same error as I was having.
I also am completely sure that the file is a proper .mat file
Also if this has to do with the lenght of the name/path then please give me a workaround instead of telling me to shorten the name.
If it happens to because of length then that should be considered a bug and fixed as well in my opinion.
I have a lot of files, over a 1000 which I need to keep track of what is what and the name is part of that system.
1 件のコメント
Walter Roberson
2019 年 3 月 28 日
Visually it looks like the path might exceed 260 characters which is the Windows limit unless UNC is used.
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Structures についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!