[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Error invalid concatenation of cell array with matrix
From: |
Wang S |
Subject: |
Re: Error invalid concatenation of cell array with matrix |
Date: |
Mon, 6 Jan 2014 10:08:58 +0800 |
Hi Syed,
Oh, from your code:
if ~exist('ignore_dirs', 'var')
ignore_dirs = {};
end
I guessed that the variable "ignore_dirs" was a cell (in a {}),
but this error message suggests that the variable "ignore_dirs" was a string
(in a '' or ""), not a cell (in a {}) ?
If "ignore_dirs" was a string, possible solution may be:
if ~exist('ignore_dirs', 'var')
ignore_dirs = '';
end
ignore_dirs_full = {'.','..',ignore_dirs};
------------------ Original ------------------
From: "syed khalid"<address@hidden>;
Date: Sun, Jan 5, 2014 09:02 PM
To: "Wang S"<address@hidden>; "help"<address@hidden>;
Subject: Re: Error invalid concatenation of cell array with matrix
Hello Wang
I made the modification but seem to get the following error. I am also
showing the program
octave:1> LIDC_process_annotations.m
error: sq_string cannot be indexed with {
error: evaluating argument list element number 3
error: called from:
error: /home/syedk/OCT/LIDC/find_files.m at line 46, column 18
error: /home/syedk/OCT/LIDC/LIDC_process_annotations.m at line 113, column 11
octave:1> quit
if ~exist('ignore_dirs', 'var')
ignore_dirs = {};
end
ignore_dirs_full = {'.','..',ignore_dirs{:}};
dirData = dir('/home/syedk/PAC/DATA/XML/tcia-lidc-xml/'); %# Get the
data for the current directory
dirIndex = [dirData.isdir]; %# Find the index for directories
fileList = {dirData(~dirIndex).name}'; %# Get a list of the files
mat_ind = cellfun(@(x) strcmp(x(end-3:end), extension), fileList,
'UniformOutput', true); % FIND XML FILES
fileList = fileList(mat_ind); % keep only XML files
if ~isempty(fileList)
fileList = cellfun(@(x) fullfile(dirName,x), fileList, 'UniformOutput',
false); %# Prepend path to files
end
subDirs = {dirData(dirIndex).name}; %# Get a list of the subdirectories
validIndex = ~ismember(subDirs, ignore_dirs_full); %# Find index of
subdirectories
%# that are not '.' or '..'
On Sun, Jan 5, 2014 at 1:29 AM, Wang S <address@hidden> wrote:
Hi Syed,
I'm sorry that maybe I hadn't express it clearly in the previous email.
I've just see your attachment "find_files.m". The line 46 in your file is
ignore_dirs_full = "{'.','..'},ignore_dirs(:));"
It seems that it was wrong and it maybe should be
ignore_dirs_full = {'.','..',ignore_dirs{:}};
And I think you could CC the emails to the "address@hidden" too,
so that maybe more supporters and helpers will help you in time.
Regards,
Wang S