Error in loading all the files in folder into code to run it on all files

Hello,
I am using below code and I am getting an error saying:
>> extract_6_25_degree
ans =
'l2.5_d7.6_flat_2DScat_lim25.jpg'
Brace indexing is not supported for variables of this type.
Error in extract_6_25_degree (line 14)
imagefilepath=strcat('../../images/images_','/Users/apple/Documents/MSCPROJ/database/','/',data{i},'_','/Users/apple/Documents/MSCPROJ/database/','.png');
>>
Code:
AngularPlot('/Users/apple/Documents/MSCPROJ/database/l2.5_d7.6_flat.h5','abg',[0 10 20],'minangle',6,'maxangle',25)
imagefilepath=strcat('../../images/images_','/Users/apple/Documents/MSCPROJ/database/','/',data{i},'_','/Users/apple/Documents/MSCPROJ/database/','.png');
saveas(gcf,'/Users/apple/Documents/MSCPROJ/savedimages')
%You'll need to select the appropriate intensity bins from the .h5 file. You can do this from data.coordinates.elevation.
% Below is some sample Matlab code:
data=h5ToStruct('/Users/apple/Documents/MSCPROJ/database/l2.5_d7.6_flat.h5'); % Load hdf5 into Matlab
nOrient = 1; % select the first orientation
mask = (data.coordinates.elevation>=6) .* (data.coordinates.elevation<=25); % create mask of selected region
sid3Intensity = data.intensity(mask==1, nOrient); % get the intensity from the masked region

1 Comment

imagefilepath=strcat('../../images/images_','/Users/apple/Documents/MSCPROJ/database/','/',data{i},'_','/Users/apple/Documents/MSCPROJ/database/','.png');
It is quite unlikely that that would be correct -- not unless it was being used by some specialized function that was splitting the path at underscores.
But you do not show the variable being used, so it is not clear why you are doing the assignment at all.

Sign in to comment.

Answers (0)

Categories

Find more on Simulink Design Optimization in Help Center and File Exchange

Asked:

on 17 May 2021

Commented:

on 18 May 2021

Community Treasure Hunt

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

Start Hunting!