Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

what's the matter when i run a M.file?

조회 수: 1 (최근 30일)
Huadong Hu
Huadong Hu 2019년 4월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
These below are part of the contents of the M.file i want to run.
clc;
clear all;
clc;
addpath(genpath('Sample_test'));
addpath(genpath('LFToolbox0.4'));
LFMatlabPathSetup;
%% Step1: Decompress data.C.0/1/2/3---> to get white image data
fprintf('===============Step1: Unpack Lytro Files===============\n\n ');
LFUtilUnpackLytroArchive('Sample_test')
These below are the results in the command.
===============Step1: Unpack Lytro Files===============
Searching for files [ data.C.0 ] in Sample_test
??? Error using ==> textscan
First input must be of type double.
Error in ==> LFToolbox0.4\LFFindFilesRecursive.m at 83
FolderList = textscan(FolderList, '%s', 'Delimiter', pathsep);
Error in ==> LFToolbox0.4\LFUtilUnpackLytroArchive.m at 44
[AllVolumes, BasePath] = LFFindFilesRecursive(InputPath, FirstVolumeFname);
Error in ==> Demo at 23
LFUtilUnpackLytroArchive('Sample_test')

답변 (2개)

TADA
TADA 2019년 4월 15일
textscan accepts a file id not a file path. Use fopen first
  댓글 수: 5
TADA
TADA 2019년 4월 15일
편집: TADA 2019년 4월 15일
Oh.... I can't say much about older versions of Matlab....
@Huadong Hu, you can try using
FileList = regexp(FileList, pathsep, 'split');
Or
FileList = strsplit(FileList, pathsep);
Hopefully that feature did exist back in 2004
Walter Roberson
Walter Roberson 2019년 4월 15일
strsplit() is r2013a .
regexp() should be there. However after you use regexp with 'split', it is a good idea to use
dirlist = regexp(FolderList, pathsep, 'split');
dirlist(cellfun(@isempty, dirlist)) = [];
FolderList = dirlist;
If Folderlist had happened to begin or end with pathsep or if there had been multiple pathsep in a row, then regexp split would have left an empty cell; the indexing and cellfun is there to delete those empty cells.

Walter Roberson
Walter Roberson 2019년 4월 15일
You are using MATLAB R14 from 2004 to attempt to run code that was written for R2014a. The code uses features that did not exist in your release.
  댓글 수: 1
Huadong Hu
Huadong Hu 2019년 4월 15일
so install R2014a version?

태그

Community Treasure Hunt

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

Start Hunting!

Translated by