我有几个数据集,名为'51.raw''52 .raw'... until '69 .raw',并且在我的代码中运行这些数据集后,这些数据集的大小从375x91x223变为具有变化的y维度的尺寸(即,'51 .raw'输出:375x45x223; '52 .raw'输出:375x50x223,...与每个数据集不同)。将数据集的大小信息添加到文件名
我想稍后使用此信息保存'.raw'文件名(即'51_375x45x223.raw'),并且还希望使用新的数据集大小稍后在我的代码中重新设计数据集。我试图这样做,但需要帮助:
for k=51:69
data=reshape(data,[375 91 223]); % from earlier in the code after importing data
% then executes code with dimensions of 'data' chaging to 375x45x223, ...
length=size(data); dimensions.([num2str(k)]) = length; %save size in 'dimensions'.
path=['C:\Example\'];
name= sprintf('%d.raw',k);
write([path name], data);
% 'write' is a function to save the dat in specified path and name (value of k). I don't know how to add the size of the dataset to the name.
而且后来我想重塑数据集的“数据”本次迭代,做一个重塑新Y尺寸值。
i.e. data=reshape(data,[375 new y-dimension 223]);
您的帮助将不胜感激。谢谢。
为什么不救尺寸*内*您在标题行的文件?这要好得多,试图使用文件名传达有关它的内容的信息 – Suever
感谢您的评论Suever,输出保存为.raw文件。然后为了在其他软件(ImageJ)中打开它,如果其他人想要这样做会更方便。另外你提到的也是我的想法,但我被要求将其更改为文件名,但我不知道如何。 –