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

조회 수: 1 (최근 30일)
Nidhi Chakravarthy
Nidhi Chakravarthy 2021년 5월 17일
댓글: Walter Roberson 2021년 5월 18일
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
Walter Roberson
Walter Roberson 2021년 5월 18일
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.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 HDF5에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by