Function is not defined for 'cell' inputs

27 ビュー (過去 30 日間)
yio92
yio92 2013 年 10 月 2 日
コメント済み: YS 2023 年 12 月 26 日
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 件のコメント
Walter Roberson
Walter Roberson 2023 年 12 月 26 日
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
YS 2023 年 12 月 26 日
thank you! it works!

サインインしてコメントする。

採用された回答

dpb
dpb 2013 年 10 月 2 日
??? Error using ==> sprintf Function is not defined for 'cell' inputs.
That's correct; either use
sprintf(fmtstring,char(cellVar(i)))
or be sure to dereference the cell by using the curly braces --
sprintf(fmtstring, cell_Var{i})
  1 件のコメント
yio92
yio92 2013 年 10 月 2 日
ok thank u. I will try it

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by