From: Walter Roberson on 7 Aug 2010 13:08 Nehal wrote: > function G = test > > tifFiles = dir('*.tif'); %takes all the images from the folder Sample > > for k = 1:length(tifFiles) %the loop will continue for the number of > images > filename = tifFiles(k).name; % takes the an image and it's > file name > I = imread(filename); % reads the image to I > > G(:,k)= I(:); % reshapes the matrix into 1 column > end > > end > I am suppose to get a variable "G" in my workspace. But it is still not > showing. Why..? As you are resistant to the correct and accurate solutions you have been shown, you need to add the following hack to your program: assignin('caller', 'G', G);
From: Matt J on 7 Aug 2010 13:11 "Nehal " <arnab620(a)yahoo.com> wrote in message <i3k31f$6j$1(a)fred.mathworks.com>... all the images are the same size... > > 2nd... > I have the idea that some how "G" (G = test) in my code is getting destroyed.. I tried to come up with a solution.. but wasn't able to. =================== But now you understand that it does not get destroyed, correct? When you run the function function G=test ... G=....; %This doesn't end the result G is just a temporary variable that will be assigned to the variable "ans" in the workspace where you issued a call to test(). That will always automatically happen unless you specifically assign the result to something else.
From: Nehal on 7 Aug 2010 13:37 Walter Roberson <roberson(a)hushmail.com> wrote in message <Spg7o.40648$Bh2.12963(a)newsfe04.iad>... > Nehal wrote: > > function G = test > > > > tifFiles = dir('*.tif'); %takes all the images from the folder Sample > > > > for k = 1:length(tifFiles) %the loop will continue for the number of > > images > > filename = tifFiles(k).name; % takes the an image and it's > > file name > > I = imread(filename); % reads the image to I > > > > G(:,k)= I(:); % reshapes the matrix into 1 column > > end > > > > end > > I am suppose to get a variable "G" in my workspace. But it is still not > > showing. Why..? > > As you are resistant to the correct and accurate solutions you have been > shown, you need to add the following hack to your program: > > assignin('caller', 'G', G); Thank You a lot. It worked. And Thank You EVERYONE for helping me out.. :)
From: Matt J on 7 Aug 2010 17:16 "Nehal " <arnab620(a)yahoo.com> wrote in message <i3k5jv$9ji$1(a)fred.mathworks.com>... > > > > assignin('caller', 'G', G); > > Thank You a lot. It worked. It's a dangerous solution. If you don't understand why it's unnecessary, you're bound for trouble.
From: Walter Roberson on 7 Aug 2010 23:21 Matt J wrote: > "Nehal " <arnab620(a)yahoo.com> wrote in message > <i3k5jv$9ji$1(a)fred.mathworks.com>... > >> > > assignin('caller', 'G', G); >> >> Thank You a lot. It worked. > > > It's a dangerous solution. If you don't understand why it's unnecessary, > you're bound for trouble. Some people just don't learn until the light matches burn their fingers. :(
First
|
Prev
|
Pages: 1 2 3 4 Prev: Saving a portion of pathname as a string? Next: Decimation Problem |