Function is not defined for 'cell' inputs
Ältere Kommentare anzeigen
Please help me. This is my code but i have a problem
??? Error using ==> sprintf Function is not defined for 'cell' inputs.
clear; close all; clc;
DirName='C:\Matlab';
Organ={'Colon'}; Mag={'10x'}; TimePt={'3hr'}; MouseNum=[1]; SampleNum=[1];
%fid=fopen('results.csv','w'); %fprintf(fid,'Organ;Time Point;Mouse Number;Site;GFP_Total_G;GFP_Total_R;Cy3_Total;Tissue_Pixels\r');
load corectimage;
% Create filename and open the images if strcmp(Organ,'Colon') FileNameG=sprintf('%s\\%s\\%s\\%s\\M%d-E1-I800-G-%d.tif',DirName,Organ,TimePt, Mag, MouseNum, SampleNum); imG=imread(FileNameG,'TIFF'); FileNameC=sprintf('%s\\%s\\%s\\%s\\M%d-E1-I800-C-%d.tif',DirName,Organ,TimePt, Mag, MouseNum, SampleNum); imC=imread(FileNameC,'TIFF'); else FileNameG=sprintf('%s\\%s\\%s\\M%d-E1-I800-G-%d.tif',DirName,Organ,TimePt, MouseNum, SampleNum); imG=imread(FileNameG,'TIFF'); FileNameC=sprintf('%s\\%s\\%s\\M%d-E1-I800-C-%d.tif',DirName,Organ,TimePt, MouseNum, SampleNum); imC=imread(FileNameC,'TIFF'); end;
% Correct the image intensity (only for Mag=4x) if strcmp(Mag,'4x') imG=double(imG); imC=double(imC); load(sprintf('%s\\corectimage.mat',DirName)); imG(:,:,1)=imG(:,:,1).*imXG; imG(:,:,2)=imG(:,:,2).*imXG; imG(:,:,3)=imG(:,:,3).*imXG; imC(:,:,1)=imC(:,:,1).*imXC; imC(:,:,2)=imC(:,:,2).*imXC; imC(:,:,3)=imC(:,:,3).*imXC; imG=uint8(imG); imC=uint8(imC); end;
imshow(imG);
%fclose(fid);
3 Kommentare
YS
am 26 Dez. 2023
Hi, i met the same error. Could you please tell me how to address this error? Thank you very much!
Walter Roberson
am 26 Dez. 2023
At some point in your code, you have an sprintf() that attempts to format a cell array. You need to change that so that it attempts to format the content of the cell array.
For example, instead of attempting to format cell_Var(i) instead format cell_Var{i}
YS
am 26 Dez. 2023
thank you! it works!
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Images finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!