Thread Subject:
save_subimages

Subject: save_subimages

From: St.Ivanov

Date: 1 Sep, 2012 09:46:08

Message: 1 of 138

Matt,
I went back to the very first code so that I can check the result now with the one it has to be and did subimages division my way just for this case (I mean: K1=K(1:32,1:32)), replacing K1 with subimages{1,1}:

subimages{1,1}=K(1:32,1:32)
subimages{1,2}=K(33:64,1:32)
subimages{1,3}=K(65:96,1:32)
etc...

Then, I used 'subimages{1,1}' to make up 'save':
save ('seavars1','subimages{1,1}')

An error message appeared:

??? Error using ==> save
'subimages{1,1}' is not a valid variable name.

Error in ==> Untitled16_subimages at 76
save ('seavars1','subimages{1,1}')

Do I have to assign subimages{1,1} to something else?

Subject: save_subimages

From: St.Ivanov

Date: 1 Sep, 2012 10:16:16

Message: 2 of 138

I've been thinking on loops for i and j so that division ecexutes on 'for i=8' and 'for j=8'
and 'save' for these loops too, applying 'sprintf('%s/%02d.mat'...).

How can I do this?
Or do you have any better idea?

The tranformation is high-speed so it would be nice to make up short code as far as possible and keep this advantage to the transformation. This is one of the ideas.

Subject: save_subimages

From: Matt J

Date: 1 Sep, 2012 15:57:07

Message: 3 of 138

"St.Ivanov" wrote in message <k1sn9g$rsl$1@newscl01ah.mathworks.com>...
> I've been thinking on loops for i and j so that division ecexutes on 'for i=8' and 'for j=8'
> and 'save' for these loops too, applying 'sprintf('%s/%02d.mat'...).
>
> How can I do this?
> Or do you have any better idea?
>
> The tranformation is high-speed so it would be nice to make up short code as far as possible and keep this advantage to the transformation. This is one of the ideas.

I think the best way to debug is to focus on getting particular pieces of code to work first. First, make sure your original transformation still works

 [Yl1,Yh1] = dtwavexfm2(K1,3,'near_sym_b','qshift_b');

Then, do

isequal(K1, subimages{1,1})

and see what it returns. If it returns 1, then do

 [Yl2,Yh2] = dtwavexfm2(subimages{1},3,'near_sym_b','qshift_b');

and if that returns without errors, do this

isequal(Yl1,Yl2), isequal(Yh1,Yh2)

to see if they both give the same result.

Subject: save_subimages

From: St.Ivanov

Date: 2 Sep, 2012 15:10:08

Message: 4 of 138

Matt,

First, I did all the initial tests recommended by the author, then executed the transformation on two (other) different images. The achieved results were discussed, estimated as reasonable with logical explanation and approved.

Then, I did the check you suggeted and here are the results:

[Yl1,Yh1] = dtwavexfm2(K1,3,'near_sym_b','qshift_b');
correct result

isequal(K1, subimages{1,1})
s=1

[Yl2,Yh2] = dtwavexfm2(subimages{1},3,'near_sym_b','qshift_b');
no error

isequal(Yl1,Yl2), isequal(Yh1,Yh2)
ans=1
ans=1

Now,

for p=1:1000
   for q=1:64
     for i=1:64

          [Yl{q},Yh{q}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
     
      end
   end
end

Do I think right?

Subject: save_subimages

From: St.Ivanov

Date: 2 Sep, 2012 15:23:05

Message: 5 of 138

> for p=1:1000
> for q=1:64
> for i=1:64
>
> [Yl{q},Yh{q}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
>
> end
> end
> end
>
> Do I think right?
*******
Or even:

  for p=1:1000
> for i=1:64
>
> [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
>
> end
> end

Subject: save_subimages

From: Matt J

Date: 2 Sep, 2012 17:33:07

Message: 6 of 138

"St.Ivanov" wrote in message <k1vtkp$pm5$1@newscl01ah.mathworks.com>...
>
> Or even:
>
> for p=1:1000
> > for i=1:64
> >
> > [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
> >
> > end
> > end


Yes. I think this should work.

Subject: save_subimages

From: St.Ivanov

Date: 4 Sep, 2012 07:29:07

Message: 7 of 138

Matt,

I wrote to the author of the transformation describing the problem with the cell arrays.
Here is what he answered:
"You will need to write a 'for' loop which selects each image in turn from the cell array and does the DTCWT on it as a normal matrix."
Then why didn't it work for i=8 and j=8 (in your approach)?
Is there something else that should to be done?

Subject: save_subimages

From: St.Ivanov

Date: 4 Sep, 2012 08:28:06

Message: 8 of 138

Sorry,
> Is there something else that should to be done?
Is there anything else that should to be done?

Matt,

What does he mean by 'normal matrix'? 1D array?
And if it so then the solution is:

 [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');

?

Subject: save_subimages

From: Matt J

Date: 4 Sep, 2012 11:36:08

Message: 9 of 138

"St.Ivanov" wrote in message <k24e2m$a6j$1@newscl01ah.mathworks.com>...
> Sorry,
> > Is there something else that should to be done?
> Is there anything else that should to be done?
>
> Matt,
>
> What does he mean by 'normal matrix'? 1D array?
> And if it so then the solution is:
================

When he says "normal matrix", he just means an ordinary matrix, as opposed to a cell array. I'm a bit confused about what is working and what is not. Is the following working, like we talked about before? You seemed to be saying that it was fine

 for i=1:64
 
  [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
 
 end


If this is working, I don't know why you want to change anything, but regardless, the following should work too in an exactly equivalent way


 for i=1:8
  for j=1:8
 
  [Yl{i,j},Yh{i,j}] = dtwavexfm2(subimages{i,j},3,'near_sym_b','qshift_b');
 
 end
end

Subject: save_subimages

From: St.Ivanov

Date: 4 Sep, 2012 15:12:08

Message: 10 of 138


Matt,

I'm over with
for i=1:64
  [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
end

---

inputFolder = 'Subimages MAT files';
for i = 1:1000
    inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
    load(inputFilename, 'subimages');
    Yl=cell(size(subimages)); Yh=Yl;
    
for i=1:64
  [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
end
end

But Matlab returned neither error message nor any result.
Matlab was calculating but didn't retrieve any result on the screen.
And as I wrote in the " xlswrite problem" thread, I have to put the results into an excel file.
I suppose this is what should be done now to see results (if there are any).
And if I'm right:

[Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');

xlswrite('Kingsbury_results',{'Black'}, 'Sheet1', 'A1');
xlswrite('Kingsbury_results',{'White'}, 'Sheet1', 'B1');
xlswrite('Kingsbury_results',Yl{i},'Sheet1', 'A2:A65');
xlswrite('Kingsbury_results',Yh{i},'Sheet1', 'B2:B65');

?

Subject: save_subimages

From: Matt J

Date: 4 Sep, 2012 16:17:30

Message: 11 of 138

"St.Ivanov" wrote in message <k255o8$7mu$1@newscl01ah.mathworks.com>...
>
> for i=1:64
> [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
> end
> end
>
> But Matlab returned neither error message nor any result.
> Matlab was calculating but didn't retrieve any result on the screen.
> And as I wrote in the " xlswrite problem" thread, I have to put the results into an excel file.
> I suppose this is what should be done now to see results (if there are any).
> And if I'm right:
>
> [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
>
> xlswrite('Kingsbury_results',{'Black'}, 'Sheet1', 'A1');
> xlswrite('Kingsbury_results',{'White'}, 'Sheet1', 'B1');
> xlswrite('Kingsbury_results',Yl{i},'Sheet1', 'A2:A65');
> xlswrite('Kingsbury_results',Yh{i},'Sheet1', 'B2:B65');
================

I'm not sure why expect a result on screen. Do you have any commands in your code which should display things to the screen? As for exporting results to Excel, what happened when you tried? In any case, you need to be sure that the range of cells you specified with xlswrite will match the size of the array you are writing. What are the dimensions of Yh{i}? If you want to write it to B2:B65, you need to be sure that it is a length 64 row vector. Also, bear in mind that every time the loop repeats, the data you write to B2:B65 in 'Kingsbury_results' will be overwritten. You need to write the data to different files and/or locations for different i.

 

Subject: save_subimages

From: St.Ivanov

Date: 4 Sep, 2012 16:36:08

Message: 12 of 138

Matt,

I tried it for i=1:

inputFolder = 'Subimages MAT files';

for i = 1:1000
    inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
    load(inputFilename, 'subimages');
    Yl=cell(size(subimages)); Yh=Yl;
 for i=1:1
  [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');

    xlswrite('Kingsbury_results.xls',{'Black'}, 'Sheet1', 'A1');
    xlswrite('Kingsbury_results.xls',{'White'}, 'Sheet1', 'B1');
    xlswrite('Kingsbury_results.xls',Yl{i},'Sheet1', 'A2:A65');
    xlswrite('Kingsbury_results.xls',Yh{i},'Sheet1', 'B2:B65');
end
end


??? Error using ==> xlswrite at 253
ActiveX - Elements of cell array must have 2 dimensions.

Error in ==> Untitled16_Kingsbury2 at 24
    xlswrite('Kingsbury_results.xls',Yh{i},'Sheet1', 'B2:B65');
 

I do hope I'm doing it wrong.

Subject: save_subimages

From: St.Ivanov

Date: 4 Sep, 2012 16:37:08

Message: 13 of 138

Matt,

I tried it for i=1:

inputFolder = 'Subimages MAT files';

for i = 1:1000
    inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
    load(inputFilename, 'subimages');
    Yl=cell(size(subimages)); Yh=Yl;
 for i=1:1
  [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');

    xlswrite('Kingsbury_results.xls',{'Black'}, 'Sheet1', 'A1');
    xlswrite('Kingsbury_results.xls',{'White'}, 'Sheet1', 'B1');
    xlswrite('Kingsbury_results.xls',Yl{i},'Sheet1', 'A2:A65');
    xlswrite('Kingsbury_results.xls',Yh{i},'Sheet1', 'B2:B65');
end
end


??? Error using ==> xlswrite at 253
ActiveX - Elements of cell array must have 2 dimensions.

Error in ==> Untitled16_Kingsbury2 at 24
    xlswrite('Kingsbury_results.xls',Yh{i},'Sheet1', 'B2:B65');
 

I do hope I'm doing it wrong.

Subject: save_subimages

From: St.Ivanov

Date: 4 Sep, 2012 16:55:23

Message: 14 of 138

Matt,

I did something more:

inputFolder = 'Subimages MAT files';
for i = 1:1000
    inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
    load(inputFilename, 'subimages');
    Yl=cell(size(subimages)); Yh=Yl;
for i=1:1
  [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
    s=Yl{i}
    t=Yh{i}
    xlswrite('Kingsbury_results.xls',{'Black'}, 'Sheet1', 'A1');
    xlswrite('Kingsbury_results.xls',{'White'}, 'Sheet1', 'B1');
    xlswrite('Kingsbury_results.xls',Yl{i},'Sheet1', 'A2:A65');
    xlswrite('Kingsbury_results.xls',Yh{i},'Sheet1', 'B2:B65');
end
end
---
s =

  Columns 1 through 7

    1.5712 1.7316 1.7877 1.7069 1.7630 1.7637 1.3704
    1.3530 1.4928 1.6536 1.6714 1.6227 1.5342 1.3042
    1.3813 1.3319 1.4130 1.5912 1.6482 1.4671 1.1917
    1.3810 1.3059 1.2745 1.4588 1.7193 1.6332 1.1964
    1.2296 1.3269 1.3458 1.3784 1.6025 1.7094 1.3596
    1.3052 1.4408 1.5271 1.4574 1.4513 1.5642 1.4601
    1.2480 1.3156 1.4308 1.4434 1.3921 1.4101 1.3804
    0.8070 0.9552 1.1622 1.3024 1.3789 1.3795 1.2567

  Column 8

    0.8615
    1.0325
    1.0219
    0.8495
    0.8972
    1.1623
    1.2456
    1.0976


t =

    [16x16x6 double]
    [ 8x8x6 double]
    [ 4x4x6 double]

??? Error using ==> xlswrite at 253
ActiveX - Elements of cell array must have 2 dimensions.

Error in ==> Untitled16_Kingsbury2 at 26
    xlswrite('Kingsbury_results.xls',Yh{i},'Sheet1', 'B2:B65');
 

Subject: save_subimages

From: St.Ivanov

Date: 4 Sep, 2012 17:10:08

Message: 15 of 138

Matt,

I did something more:

inputFolder = 'Subimages MAT files';
for i = 1:1000
    inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
    load(inputFilename, 'subimages');
    Yl=cell(size(subimages)); Yh=Yl;
for i=1:1
  [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
    s=Yl{i}
    t=Yh{i}
    xlswrite('Kingsbury_results.xls',{'Black'}, 'Sheet1', 'A1');
    xlswrite('Kingsbury_results.xls',{'White'}, 'Sheet1', 'B1');
    xlswrite('Kingsbury_results.xls',Yl{i},'Sheet1', 'A2:A65');
    xlswrite('Kingsbury_results.xls',Yh{i},'Sheet1', 'B2:B65');
end
end
---
s =

  Columns 1 through 7

    1.5712 1.7316 1.7877 1.7069 1.7630 1.7637 1.3704
    1.3530 1.4928 1.6536 1.6714 1.6227 1.5342 1.3042
    1.3813 1.3319 1.4130 1.5912 1.6482 1.4671 1.1917
    1.3810 1.3059 1.2745 1.4588 1.7193 1.6332 1.1964
    1.2296 1.3269 1.3458 1.3784 1.6025 1.7094 1.3596
    1.3052 1.4408 1.5271 1.4574 1.4513 1.5642 1.4601
    1.2480 1.3156 1.4308 1.4434 1.3921 1.4101 1.3804
    0.8070 0.9552 1.1622 1.3024 1.3789 1.3795 1.2567

  Column 8

    0.8615
    1.0325
    1.0219
    0.8495
    0.8972
    1.1623
    1.2456
    1.0976


t =

    [16x16x6 double]
    [ 8x8x6 double]
    [ 4x4x6 double]

??? Error using ==> xlswrite at 253
ActiveX - Elements of cell array must have 2 dimensions.

Error in ==> Untitled16_Kingsbury2 at 26
    xlswrite('Kingsbury_results.xls',Yh{i},'Sheet1', 'B2:B65');
 

Subject: save_subimages

From: Matt J

Date: 4 Sep, 2012 17:32:08

Message: 16 of 138

"St.Ivanov" wrote in message <k25clg$68a$1@newscl01ah.mathworks.com>...
>
> [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
> s=Yl{i}
> t=Yh{i}
================

Instead of doing things like this, you should learn to use breakpoints

>> docsearch breakpoints

This will let you pause the program at certain lines and examine the contents of variables.



>
> t =
>
> [16x16x6 double]
> [ 8x8x6 double]
> [ 4x4x6 double]
>
> ??? Error using ==> xlswrite at 253
> ActiveX - Elements of cell array must have 2 dimensions.
>
> Error in ==> Untitled16_Kingsbury2 at 26
> xlswrite('Kingsbury_results.xls',Yh{i},'Sheet1', 'B2:B65');
==================

This seems self-explanatory. You can see from your output that t=Yh{i} does not contain numeric matrix data. It contains another cell. That's why xlswrite processes s=Yl{i} with no problems, while Yh gives you an error.

Subject: save_subimages

From: St.Ivanov

Date: 4 Sep, 2012 19:47:07

Message: 17 of 138

[Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
s=Yl{i}
 t=Yh{i}

Ok, Matt,
I replaced it with the red point.

>You need to write the data to different files and/or locations for different i.

Do you mean 1000 .xls preliminarily created files? Manually?
Because if it so, I feel like bursting into laughter.

Subject: save_subimages

From: Matt J

Date: 4 Sep, 2012 19:58:07

Message: 18 of 138

"St.Ivanov" wrote in message <k25lrr$epp$1@newscl01ah.mathworks.com>...
> [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
> s=Yl{i}
> t=Yh{i}
>
> Ok, Matt,
> I replaced it with the red point.
>
> >You need to write the data to different files and/or locations for different i.
>
> Do you mean 1000 .xls preliminarily created files? Manually?
> Because if it so, I feel like bursting into laughter.

Well, only you can know what you want the output to look like. But do you understand what will happen if you write the results to the same file and the same cell range in every iteration i of the loop? You'll be overwriting everything you put there in iteration i-1.
Maybe write them to different cell ranges in the same .xls file?

Subject: save_subimages

From: St.Ivanov

Date: 4 Sep, 2012 20:28:08

Message: 19 of 138

Matt,

the point is that I'm not sure in the usefulness of so many .xls files.
On the other hand, using only one .xls is another challenge.
I'll be thinking.

Subject: save_subimages

From: Matt J

Date: 4 Sep, 2012 20:39:08

Message: 20 of 138

"St.Ivanov" wrote in message <k25o8o$obe$1@newscl01ah.mathworks.com>...
> Matt,
>
> the point is that I'm not sure in the usefulness of so many .xls files.
> On the other hand, using only one .xls is another challenge.
> I'll be thinking.

I don't know what you want to do about Yh. I only vaguely understand what it contains. However, it should be very easy to export the Yl data for all 1000 sets in just a single command. AFTER the loop finishes, you would do, for example

Yl=cell2mat(Yl(:).');
Yl=reshape(Yl,64,[]);

xlswrite('MyFile',Yl,'Sheet1', 'A2');

Subject: save_subimages

From: St.Ivanov

Date: 4 Sep, 2012 21:12:07

Message: 21 of 138

"Matt J" wrote in message <k25otc$qle$1@newscl01ah.mathworks.com>...
> "St.Ivanov" wrote in message <k25o8o$obe$1@newscl01ah.mathworks.com>...
> > Matt,
> >
> > the point is that I'm not sure in the usefulness of so many .xls files.
> > On the other hand, using only one .xls is another challenge.
> > I'll be thinking.
>
> I don't know what you want to do about Yh. I only vaguely understand what it contains. However, it should be very easy to export the Yl data for all 1000 sets in just a single command. AFTER the loop finishes, you would do, for example
>
> Yl=cell2mat(Yl(:).');
> Yl=reshape(Yl,64,[]);
>
> xlswrite('MyFile',Yl,'Sheet1', 'A2');

Matt,

>I don't know what you want to do about Yh. I only vaguely understand what it contains.

So do I. To some extent. Besides, I don't think the information it contains would be necessary for image recognition. But this will be discussed tomorrow.
---
AFTER the loop finishes, you would do, for example
>
> Yl=cell2mat(Yl(:).');
> Yl=reshape(Yl,64,[]);
>
> xlswrite('MyFile',Yl,'Sheet1', 'A2');

I do thank you, Matt.




   

Subject: save_subimages

From: St.Ivanov

Date: 5 Sep, 2012 12:34:08

Message: 22 of 138

Matt,

>However, it should be very easy to export the Yl data for all 1000 sets in just a single >command. AFTER the loop finishes, you would do, for example
>
> Yl=cell2mat(Yl(:).');
> Yl=reshape(Yl,64,[]);
>
> xlswrite('MyFile',Yl,'Sheet1', 'A2');

Ok. But doesn't the result overwrite?
Look:
for i = 1:1000
    inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
    load(inputFilename, 'subimages');
    Yl=cell(size(subimages)); Yh=Yl;
   
       for i=1:64
              [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
       end
  Yl=cell2mat(Yl(:).');
  Yl=reshape(Yl,64,[]);
  xlswrite('MyFile',Yl,'Sheet1', 'A2');
end

As if I reach to:
>You'll be overwriting everything you put there in iteration i-1.
?
Then, how can I write the result for i=1:1000 in different sheets?
I read 'docsearch xlswrite' and didn't see any limit of sheets in one .xls document.

Subject: save_subimages

From: St.Ivanov

Date: 5 Sep, 2012 13:24:07

Message: 23 of 138

Matt,

for i = 1:1000
    inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
    load(inputFilename, 'subimages');
    Yl=cell(size(subimages)); Yh=Yl;
      for i=1:64
         [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
      end
   Yl=cell2mat(Yl(:).');
   Yl=reshape(Yl,64,[]);
   xlswrite('MyFile',Yl,'Sheet{i}', 'A2');
end

Right?

Subject: save_subimages

From: Matt J

Date: 5 Sep, 2012 13:24:07

Message: 24 of 138

"St.Ivanov" wrote in message <k27gs0$1cq$1@newscl01ah.mathworks.com>...
> Matt,
>
> >However, it should be very easy to export the Yl data for all 1000 sets in just a single >command. AFTER the loop finishes, you would do, for example
> >
> > Yl=cell2mat(Yl(:).');
> > Yl=reshape(Yl,64,[]);
> >
> > xlswrite('MyFile',Yl,'Sheet1', 'A2');
>
> Ok. But doesn't the result overwrite?
> Look:
> for i = 1:1000
> inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
> load(inputFilename, 'subimages');
> Yl=cell(size(subimages)); Yh=Yl;
>
> for i=1:64
> [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
> end
================

You should use a different variable for this loop

    for j=1:64
             [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
   end



> xlswrite('MyFile',Yl,'Sheet1', 'A2');
=============

I said to do this AFTER the loop finishes. Both loops.

Subject: save_subimages

From: St.Ivanov

Date: 5 Sep, 2012 13:34:08

Message: 25 of 138


> I said to do this AFTER the loop finishes. Both loops.

I did it, Matt.
Ok, I'll try again.

Subject: save_subimages

From: Matt J

Date: 5 Sep, 2012 13:35:08

Message: 26 of 138

"St.Ivanov" wrote in message <k27jpn$cui$1@newscl01ah.mathworks.com>...
> Matt,
>
> for i = 1:1000
> inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
> load(inputFilename, 'subimages');
> Yl=cell(size(subimages)); Yh=Yl;
> for i=1:64
> [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
> end
> Yl=cell2mat(Yl(:).');
> Yl=reshape(Yl,64,[]);
> xlswrite('MyFile',Yl,'Sheet{i}', 'A2');
> end
======================

Now that you're no longer interested in Yh (your code above doesn't use it at all) why not just do as follows? You can save the entire data set Yl to a .mat file. It seems too big to put in an Excel sheet.

Yl=zeros(8,8,64,1000,'single');

for i = 1:1000

    inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
    load(inputFilename, 'subimages');

      for j=1:64
         Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
      end

end

save('MyFile','Yl');

Subject: save_subimages

From: St.Ivanov

Date: 5 Sep, 2012 14:00:08

Message: 27 of 138

Matt,

trying to write values this way:
for i = 1:1000
    inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
    load(inputFilename, 'subimages');
    Yl=cell(size(subimages)); Yh=Yl;
for j=1:64
  [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
end
end
Yl=cell2mat(Yl(:).');
Yl=reshape(Yl,64,[]);
xlswrite('MyFile',Yl,'Sheet1', 'A2');

puts the values of the 1000th image only.
I'll try the code from the previous post.

Subject: save_subimages

From: St.Ivanov

Date: 5 Sep, 2012 14:03:07

Message: 28 of 138

 
> Now that you're no longer interested in Yh (your code above doesn't use it at all) why not just do as follows? You can save the entire data set Yl to a .mat file. It seems too big to put in an Excel sheet.
>
> Yl=zeros(8,8,64,1000,'single');
>
> for i = 1:1000
>
> inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
> load(inputFilename, 'subimages');
>
> for j=1:64
> Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
> end
>
> end
>
> save('MyFile','Yl');
------

Ok. But how am I going to import it into SQL Server then?
Do I miss any link?

Subject: save_subimages

From: Matt J

Date: 5 Sep, 2012 14:15:08

Message: 29 of 138

"St.Ivanov" wrote in message <k27m2r$mdl$1@newscl01ah.mathworks.com>...
>
> > Now that you're no longer interested in Yh (your code above doesn't use it at all) why not just do as follows? You can save the entire data set Yl to a .mat file. It seems too big to put in an Excel sheet.
> >
> > Yl=zeros(8,8,64,1000,'single');
> >
> > for i = 1:1000
> >
> > inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
> > load(inputFilename, 'subimages');
> >
> > for j=1:64
> > Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
> > end
> >
> > end
> >
> > save('MyFile','Yl');
> ------
>
> Ok. But how am I going to import it into SQL Server then?
> Do I miss any link?
================

What you missed is that you never told us that this was going to an SQL server or why it needs an Excel sheet as input. I have no familiarity with SQL, I'm afraid. However, now that you have Yl as an 8x8x64x1000 array, you can split it up as you like and write it to however many Excel files/sheets you like. You could even try to reshape it to a 64x64000 data set and write it to a single sheet

Yl=reshape(Yl,64,64000);

I'm just not sure an Excel sheet will hold 64000 columns. If it can hold 64000 rows, you could just transpose it

Yl=Yl.';

before writing it to Excel.

Dunno. You as the engineer have to figure out what sized chunks the thing you're exporting to can swallow.

Subject: save_subimages

From: St.Ivanov

Date: 5 Sep, 2012 14:46:06

Message: 30 of 138

Ok, Matt,
I started a new thread since this one became too long.
I apologize.
I didn't know that rule.

At least, is there any option for generating 1000 .xls files?

Subject: save_subimages

From: Matt J

Date: 5 Sep, 2012 15:02:08

Message: 31 of 138

"St.Ivanov" wrote in message <k27oje$3a4$1@newscl01ah.mathworks.com>...
> Ok, Matt,
> I started a new thread since this one became too long.
> I apologize.
> I didn't know that rule.
>
> At least, is there any option for generating 1000 .xls files?

make your output file name dependent on i=1:1000 the same way your input file name does.

Subject: save_subimages

From: Matt J

Date: 5 Sep, 2012 15:15:08

Message: 32 of 138

"St.Ivanov" wrote in message <k27oje$3a4$1@newscl01ah.mathworks.com>...
> Ok, Matt,
> I started a new thread since this one became too long.
> I apologize.

Hah! If you think this is a long thread, take a look at this:

http://www.mathworks.com/matlabcentral/newsreader/view_thread/151925#870338

Subject: save_subimages

From: Steven_Lord

Date: 5 Sep, 2012 15:44:11

Message: 33 of 138



"Matt J " <mattjacREMOVE@THISieee.spam> wrote in message
news:k27q9s$a41$1@newscl01ah.mathworks.com...
> "St.Ivanov" wrote in message <k27oje$3a4$1@newscl01ah.mathworks.com>...
>> Ok, Matt,
>> I started a new thread since this one became too long.
>> I apologize.
>
> Hah! If you think this is a long thread, take a look at this:
>
> http://www.mathworks.com/matlabcentral/newsreader/view_thread/151925#870338

The longest thread currently available in the "All Time" view on the MATLAB
Central newsreader is an old one that I think must have hopped over here
from sci.math:

http://www.mathworks.com/matlabcentral/newsreader/view_thread/83746

Also on the first page of the "Duration: All Time, sorted by Replies"
listing:

What appear to be most or all of the MATLAB contest newsgroup threads.
Several threads cross-posted to CSSM from comp.dsp.
The undying "plz send complete voice recognition source code to my email"
thread.

The "angle between two vectors" thread you mentioned is on the second half
of that page.

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: save_subimages

From: St.Ivanov

Date: 5 Sep, 2012 15:54:07

Message: 34 of 138

I have 1000 .xls files containing correct values.
---

Thank you for your help, Matt.
I appreciate it.

Best regards,
 
St.Ivanov

Subject: save_subimages

From: St.Ivanov

Date: 6 Sep, 2012 13:35:08

Message: 35 of 138

Matt,

I'm not against the rules but I'm not an offender as well.
I felt quite QUILTY.
I rely on you to tell me what the rules are.

Subject: save_subimages

From: St.Ivanov

Date: 6 Sep, 2012 13:47:07

Message: 36 of 138

Matt,

t =

    [16x16x6 double]
    [ 8x8x6 double]
    [ 4x4x6 double]
    [ 2x2x6 double]

mean the transformation level.
For the second level there are 256 values for an subimage, for the third level- 64 values and for the fourth level- 16 values.

As for:
for j=1:64
> > Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
> > end

shall it raise the speed more than

for j=1:64
  [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
end

?

Subject: save_subimages

From: St.Ivanov

Date: 6 Sep, 2012 13:57:07

Message: 37 of 138


     [16x16x6 double] - fourth level image decomposition
     [ 8x8x6 double] - third level image decomposition
     [ 4x4x6 double] - second level image decomposition
    
 

Subject: save_subimages

From: Matt J

Date: 6 Sep, 2012 14:23:05

Message: 38 of 138

"St.Ivanov" wrote in message <k2a9gr$ec6$1@newscl01ah.mathworks.com>...
>
> As for:
> for j=1:64
> > > Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
> > > end
>
> shall it raise the speed more than
>
> for j=1:64
> [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
> end
>
> ?

Yes, numerical arrays are stored contiguously in memory, unlike cell arrays, and this usually makes them faster to access. I would be surprised if the second version was faster.

Subject: save_subimages

From: St.Ivanov

Date: 7 Sep, 2012 06:43:13

Message: 39 of 138

Matt,

What do I have to alter in

Yl=cell2mat(Yl(:).');
Yl=reshape(Yl,64,[]);
outputFilename = sprintf('%s/%02d.xls', outputFolder, i);
xlswrite(outputFilename,Yl,'Sheet1', 'A1');

Look:
Yl=zeros(8,8,64,1000,'single');
for i = 1:1000
    inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
    load(inputFilename, 'subimages');
    
for j=1:64
   
 Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');

end

Yl=cell2mat(Yl(:).');
Yl=reshape(Yl,64,[]);
outputFilename = sprintf('%s/%02d.xls', outputFolder, i);
xlswrite(outputFilename,Yl,'Sheet1', 'A1');
end

Message error:
??? Cell contents reference from a non-cell array object.

Error in ==> cell2mat at 44
cellclass = class(c{1});

Error in ==> Untitled16_Kingsbury2 at 18
Yl=cell2mat(Yl(:).');

Subject: save_subimages

From: Matt J

Date: 7 Sep, 2012 21:38:08

Message: 40 of 138

"St.Ivanov" wrote in message <k2c521$hot$1@newscl01ah.mathworks.com>...
>
> Error in ==> Untitled16_Kingsbury2 at 18
> Yl=cell2mat(Yl(:).');

MATLAB is complaining that this line caused the problem. I'm not sure why you have it there.

Subject: save_subimages

From: St.Ivanov

Date: 9 Sep, 2012 13:02:07

Message: 41 of 138

Matt,

'What you missed is that you never told us that this was going to an SQL server or why it needs an Excel sheet as input. '

I didn't say anything about SQL Server because I was not sure how the things would grow. I could only guess.

After another discussion, here is what I have to do to the end of the task:
First, the achieved results have to be transferred to SQL Server 2008 and stored in a DB (for l=3 one DB and for l=4 another).
Second, using Matlab again I have to calculate Euclidean distance on the image coefficients in both DB.
Then the results will be analysed again.
I'll create the DB and transfer the coefficients but before this:
---
1.How can I apply

for j=1:64
 Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
end

instead of:

for j=1:64
  [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
end

and create an .xls file for each image containing its coefficients just like

Yl=cell2mat(Yl(:).');
Yl=reshape(Yl,64,[]);
outputFilename = sprintf('%s/%02d.xls', outputFolder, i);
xlswrite(outputFilename,Yl,'Sheet1', 'A1');

does for
[Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b'); ?
---
2. Would you explain what hides behind the symbols Yl(:,:,j,i)?
---
3. Does Matlab have the option for writing the transformation results directly into an SQL table?
---
I needed the .xls tables to import the results into SQL Server. Do you have any
better solution?
SQL Server can work with Oracle, Access, Excel Analysis Services, data Mining Services Internet Publishing, SQLXML, text files.
In my opinion I can use only Access, Excel or any text files. Judging by this information, SQL Server cannot work with .mat files. But can Matlab write into an SQL table?

Subject: save_subimages

From: dpb

Date: 9 Sep, 2012 13:08:23

Message: 42 of 138

On 9/9/2012 8:02 AM, St.Ivanov wrote:
...

> I needed the .xls tables to import the results into SQL Server. Do you
> have any better solution?...

<http://msdn.microsoft.com/en-us/sqlserver/aa937733.aspx>

--

Subject: save_subimages

From: dpb

Date: 9 Sep, 2012 13:29:49

Message: 43 of 138

On 9/9/2012 8:08 AM, dpb wrote:
> On 9/9/2012 8:02 AM, St.Ivanov wrote:
> ...
>
>> I needed the .xls tables to import the results into SQL Server. Do you
>> have any better solution?...
>
<http://msdn.microsoft.com/en-us/sqlserver/aa937733>

Early '<RET>', sorry...

Also there's the TMW solution of the database toolbox or on File Exchange

<http://www.mathworks.com/matlabcentral/fileexchange/29615-adodbtools>

Disclaimer--I've used neither the Matlab-related above but have done the
native client from Fortran. Any of the above has to be better than
going thru half-a-dozen different other applications.

--

Subject: save_subimages

From: Matt J

Date: 9 Sep, 2012 14:21:07

Message: 44 of 138

"St.Ivanov" wrote in message <k2i40f$paf$1@newscl01ah.mathworks.com>...
> Matt,
>
> 'What you missed is that you never told us that this was going to an SQL server or why it needs an Excel sheet as input. '
>
> I didn't say anything about SQL Server because I was not sure how the things would grow. I could only guess.
>
> After another discussion, here is what I have to do to the end of the task:
> First, the achieved results have to be transferred to SQL Server 2008 and stored in a DB (for l=3 one DB and for l=4 another).
> Second, using Matlab again I have to calculate Euclidean distance on the image coefficients in both DB.
> Then the results will be analysed again.
> I'll create the DB and transfer the coefficients but before this:
> ---
> 1.How can I apply
>
> for j=1:64
> Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
> end
>
> instead of:
>
> for j=1:64
> [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
> end
>
> and create an .xls file for each image containing its coefficients just like
>
> Yl=cell2mat(Yl(:).');
> Yl=reshape(Yl,64,[]);
> outputFilename = sprintf('%s/%02d.xls', outputFolder, i);
> xlswrite(outputFilename,Yl,'Sheet1', 'A1');
>
> does for
> [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b'); ?
> ---
> 2. Would you explain what hides behind the symbols Yl(:,:,j,i)?
==================

I'm not sure I understand the question "what hides behind the symbols Yl(:,:,j,i)?"
I'm assuming you're familiar with operations like the following, correct? Assuming so, what would you say "hides" behind operations like A(:,1) and A(2,:)?

>> A=eye(2); A(:,1),A(2,:)

ans =

     1
     0


ans =

     0 1


The main difference between the two cases above is that Y(:,:,j,i) stores all your data for all j=1:64 blocks and i=1:1000 data sets simultaneously in one big 4D matrix whereas Y{j} stores the block data (for whatever fixed value i happens to be in the current loop iteration) to j=1:64 cells. If you use the WHOS command, you can see this directly.

To write the Y(:,:,j,i) data to a file, just pull out whatever chunk of data that you want by indexing the array similar to A(:,1) or A(2,:). Then use RESHAPE to put it into whatever form you want and use xlswrite.

Subject: save_subimages

From: St.Ivanov

Date: 9 Sep, 2012 15:26:07

Message: 45 of 138

'I'm assuming you're familiar with operations like the following, correct? '
Yes, correct.
---
Matt,
take a look at this:

inputFolder = 'Subimages MAT files';
outputFolder = 'Excel files_3a levels';

Yl=zeros(8,8,64,1000,'single');
for i = 1:1000
    inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
    load(inputFilename, 'subimages');
    
      for j=1:64
   
          Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');

      end

   Yl=reshape(Yl,64,[]);
   outputFilename = sprintf('%s/%02d.xls', outputFolder, i);
   xlswrite(outputFilename,Yl,'Sheet1', 'A1');
end


Error message:
??? Error using ==> xlswrite at 253
Excel returned: Error: Object returned error code: 0x800A03EC.

Error in ==> Untitled16_Transf2 at 21
xlswrite(outputFilename,Yl,'Sheet1', 'A1');

Subject: save_subimages

From: Matt J

Date: 9 Sep, 2012 16:25:08

Message: 46 of 138

"St.Ivanov" wrote in message <k2icef$mi5$1@newscl01ah.mathworks.com>...
>
> Error message:
> ??? Error using ==> xlswrite at 253
> Excel returned: Error: Object returned error code: 0x800A03EC.
>
> Error in ==> Untitled16_Transf2 at 21
> xlswrite(outputFilename,Yl,'Sheet1', 'A1');
============


I don't recognize the Excel error, but you are writing a rather large array to each sheet. Observe:

>> Yl=zeros(8,8,64,1000,'single');
>> size(reshape(Yl,64,[])),

ans =

          64 64000

Subject: save_subimages

From: Bruno Luong

Date: 9 Sep, 2012 16:47:05

Message: 47 of 138

"Matt J" wrote in message <k2ift4$3us$1@newscl01ah.mathworks.com>...
> "St.Ivanov" wrote in message <k2icef$mi5$1@newscl01ah.mathworks.com>...
> >
> > Error message:
> > ??? Error using ==> xlswrite at 253
> > Excel returned: Error: Object returned error code: 0x800A03EC.
> >
> > Error in ==> Untitled16_Transf2 at 21
> > xlswrite(outputFilename,Yl,'Sheet1', 'A1');
> ============
>
>
> I don't recognize the Excel error, but you are writing a rather large array to each sheet.

Yes, this error typically occurs when one attempt to write data larger than excel could ever store.

Bruno

Subject: save_subimages

From: St.Ivanov

Date: 9 Sep, 2012 19:41:06

Message: 48 of 138


> > I don't recognize the Excel error, but you are writing a rather large array to each sheet.
>
> Yes, this error typically occurs when one attempt to write data larger than excel could ever store.
>
> Bruno

---
Does it mean that:

 for j=1:64
   
          Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');

  end

won't do for writing into an Excel file?

Subject: save_subimages

From: dpb

Date: 9 Sep, 2012 19:56:14

Message: 49 of 138

On 9/9/2012 2:41 PM, St.Ivanov wrote:
...

> won't do for writing into an Excel file?

I've no idea specifically ('cuz I've not followed the thread until the
SQL/Excel thingie caught my eye) -- what are the sizes of the arrays in
question?

I repeat the question --what the H are you doing mucking around w/ Excel
for, anyway????!!!!

--

Subject: save_subimages

From: St.Ivanov

Date: 9 Sep, 2012 20:19:09

Message: 50 of 138

Matt,

'Yes, this error typically occurs when one attempt to write data larger than excel could ever store.'

Does it mean that:

  for j=1:64
   
          Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
 
   end
 
 won't do for writing into an Excel file?

Subject: save_subimages

From: Matt J

Date: 9 Sep, 2012 20:54:08

Message: 51 of 138

"St.Ivanov" wrote in message <k2itjt$hid$1@newscl01ah.mathworks.com>...
> Matt,
>
> 'Yes, this error typically occurs when one attempt to write data larger than excel could ever store.'
>
> Does it mean that:
>
> for j=1:64
>
> Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
>
> end
>
> won't do for writing into an Excel file?
============

No, it means that this line is the problem

  xlswrite(outputFilename,Yl,'Sheet1', 'A1');

when Yl is 64x64000. What were the dimensions of the data chunks you were sending to Excel sheets when it worked before?

Also, what about dbp's comments? Are you sure you need to be going through Excel at all?

Subject: save_subimages

From: St.Ivanov

Date: 10 Sep, 2012 17:29:07

Message: 52 of 138

dpb,

Thank you for your suggestions. I took them into consideration. No problem.
But first, I have to apply Matt's transformation and see (in Excel) if the result is the one I need.
Then, after data transfer I'll compare both results to ensure that there is no error.

I ought to keep an eye on the results !

Subject: save_subimages

From: St.Ivanov

Date: 10 Sep, 2012 17:42:08

Message: 53 of 138

Matt,

> when Yl is 64x64000. What were the dimensions of the data chunks you were sending to Excel sheets when it worked before?

for (level 3)
[Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');

Yl is 64x64
---
for (level 4)
[Yl{j},Yh{j}] = dtwavexfm2(subimages{j},4,'near_sym_b','qshift_b');

Yl is 16x64

(Matt, probably I shall not realize why the loop: for i=8 for j=8 ...end end didn't work.
I was refused whatever discussion on that issue.)

 

Subject: save_subimages

From: dpb

Date: 10 Sep, 2012 17:56:07

Message: 54 of 138

On 9/10/2012 12:29 PM, St.Ivanov wrote:
> dpb,
>
> Thank you for your suggestions. I took them into consideration. No problem.
> But first, I have to apply Matt's transformation and see (in Excel) if
> the result is the one I need.
...

Why does it take Excel? What do you think you can do in Excel you can't
do more simply/quicker in Matlab w/o the need to move data around in
more than one application?

--

Subject: save_subimages

From: Matt J

Date: 10 Sep, 2012 18:02:08

Message: 55 of 138

"St.Ivanov" wrote in message <k2l8pg$8ad$1@newscl01ah.mathworks.com>...
> Matt,
>
> > when Yl is 64x64000. What were the dimensions of the data chunks you were sending to Excel sheets when it worked before?
>
> for (level 3)
> [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
>
> Yl is 64x64
==============

okay, then why are you now trying to send a 64x64000 chunk of data to an Excel file, when previously, you were happy to send a 64x64 chunk?

Subject: save_subimages

From: Matt J

Date: 10 Sep, 2012 18:42:07

Message: 56 of 138

"St.Ivanov" wrote in message <k2l8pg$8ad$1@newscl01ah.mathworks.com>...
> Matt,
>
> > when Yl is 64x64000. What were the dimensions of the data chunks you were sending to Excel sheets when it worked before?
>
> for (level 3)
> [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
>
> Yl is 64x64
> ---
> for (level 4)
> [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},4,'near_sym_b','qshift_b');
>
> Yl is 16x64
==============

Another question. If the approach with cell arrays already works, why are you trying to do something different?


> (Matt, probably I shall not realize why the loop: for i=8 for j=8 ...end end didn't work.
> I was refused whatever discussion on that issue.)
=================

Didn't understand that part. I don't recognize "for i=8" from anywhere.

Subject: save_subimages

From: St.Ivanov

Date: 11 Sep, 2012 05:47:08

Message: 57 of 138

Ok, dpb.

Subject: save_subimages

From: St.Ivanov

Date: 11 Sep, 2012 06:03:08

Message: 58 of 138

Matt,

'okay, then why are you now trying to send a 64x64000 chunk of data to an Excel file, when previously, you were happy to send a 64x64 chunk? '

because:

>Now that you're no longer interested in Yh (your code above doesn't use it at all) >why not just do as follows? You can save the entire data set Yl to a .mat file. It >seems too big to put in an Excel sheet.
>
> Yl=zeros(8,8,64,1000,'single');
>
> for i = 1:1000
>
> inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
> load(inputFilename, 'subimages');
>
> for j=1:64
> Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
> end
>
> end
>
> save('MyFile','Yl');
---
And after that:

>As for:
>for j=1:64
> Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
> end

>shall it raise the speed more than

>for j=1:64
>[Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
>end

>?
>Yes, numerical arrays are stored contiguously in memory, unlike cell arrays, and this >usually makes them faster to access. I would be surprised if the second version >was faster.
---
That's why I want to apply
Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
and see if the result is what I need .

Subject: save_subimages

From: St.Ivanov

Date: 11 Sep, 2012 06:12:10

Message: 59 of 138

Considering this, what do you think?

Subject: save_subimages

From: St.Ivanov

Date: 11 Sep, 2012 06:12:10

Message: 60 of 138


>
> > (Matt, probably I shall not realize why the loop: for i=8 for j=8 ...end end didn't work.
> > I was refused whatever discussion on that issue.)
> =================
>
> Didn't understand that part. I don't recognize "for i=8" from anywhere.

I meant:

for i=1:I
        for j=1:J
              [Yl{i,j},Yh{i,j}] = dtwavexfm2(subimages{i,j},3,'near_sym_b','qshift_b');
        end
end

I=8, J=8

But it doesn't matter anymore.

Subject: save_subimages

From: Matt J

Date: 11 Sep, 2012 13:16:08

Message: 61 of 138

"St.Ivanov" wrote in message <k2mk6s$9as$1@newscl01ah.mathworks.com>...
>
>
> That's why I want to apply
> Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
> and see if the result is what I need .

Yes, but why are you trying to write the ENTIRE array Yl to the Excel file? You seem to want each sheet to contain 64x64 data (that was the case previously, when you were putting the data in cells Yl{j}). So why are you using XLSWRITE to send the entire array Yl, which is of a much bigger size 64x64000, to every single sheet? Just pull out the subset of data from Yl that you want and pass that to xlswrite.

Subject: save_subimages

From: Steven_Lord

Date: 11 Sep, 2012 13:38:19

Message: 62 of 138



"St.Ivanov " <sstar_05@hotmail.com> wrote in message
news:k2mk6s$9as$1@newscl01ah.mathworks.com...
> Matt,
>
> 'okay, then why are you now trying to send a 64x64000 chunk of data to an
> Excel file, when previously, you were happy to send a 64x64 chunk? '
>
> because:

*snip*

Writing data with 64000 columns in one chunk in a Microsoft Excel file won't
work. Microsoft Excel 2003 has a limit of 128 columns per worksheet:

http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP005199291.aspx

You could _just_ fit that into one worksheet if you took the transpose of
it, if that's an option. Microsoft Excel 2003 can store a 64000-by-64 matrix
of data in one worksheet.

Microsoft Excel 2010 increased the limit on the number of columns to 16384,
but that still won't work for you (again, unless you transpose the data.)

http://office.microsoft.com/en-us/excel-help/excel-specifications-and-limits-HP010342495.aspx?CTT=5&origin=HP005199291

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: save_subimages

From: dpb

Date: 11 Sep, 2012 15:16:55

Message: 63 of 138

On 9/11/2012 8:38 AM, Steven_Lord wrote:
>
>
> "St.Ivanov " <sstar_05@hotmail.com> wrote in message
> news:k2mk6s$9as$1@newscl01ah.mathworks.com...
>> Matt,
>>
>> 'okay, then why are you now trying to send a 64x64000 chunk of data to
>> an Excel file, when previously, you were happy to send a 64x64 chunk? '
>>
>> because:
>
> *snip*
>
> Writing data with 64000 columns in one chunk in a Microsoft Excel file
> won't work. Microsoft Excel 2003 has a limit of 128 columns per worksheet:
...

Not only that, we still haven't learned why (other than preconception)
there's any reason to write to Excel to begin with...

I'll ask OP again--what, specifically, does he think he's going to do in
Excel that can't be done as easy or quicker in Matlab? Consider the
amount of time we've watched floundering around here already... :(

Reminds me of the lecture I wrote to another poster a day or so ago
telling the story of another newsgroup poster trying to transliterate C
into Fortran because knows something of C but comparatively little
Fortran. Owing to that preconception of how things are done seemed to
remain completely oblivious to the suggestion of "when in Rome..." :(

All as a suggestion that if the OP would outline the actual objective
here instead of fixating on Excel it's likely would receive constructive
suggestions on solving the problem in Matlab much more directly. But,
we don't know the problem that seems to dictate moving a bunch of data
to Excel.

--

Subject: save_subimages

From: St.Ivanov

Date: 11 Sep, 2012 15:42:08

Message: 64 of 138

 dpb,

I'll try your suggestions. Give me some time. Please.

Subject: save_subimages

From: St.Ivanov

Date: 11 Sep, 2012 15:56:08

Message: 65 of 138

"Matt J" wrote in message <k2ndio$519$1@newscl01ah.mathworks.com>...
> "St.Ivanov" wrote in message <k2mk6s$9as$1@newscl01ah.mathworks.com>...
> >
> >
> > That's why I want to apply
> > Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
> > and see if the result is what I need .
>
> Yes, but why are you trying to write the ENTIRE array Yl to the Excel file? You seem to want each sheet to contain 64x64 data (that was the case previously, when you were putting the data in cells Yl{j}). So why are you using XLSWRITE to send the entire array Yl, which is of a much bigger size 64x64000, to every single sheet? Just pull out the subset of data from Yl that you want and pass that to xlswrite.
---

Matt,

How to apply

Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');

for Yl is 64x64

instead of
[Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
and then see the result.
Is there any solution?
Or shall I continue with
[Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
?
I don't need 64x64000.
I need 64x64 for level 3 and 16x64 for level 4.
This is what would help.

I want to apply
Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
because of the speed.


 

Subject: save_subimages

From: dpb

Date: 11 Sep, 2012 16:00:04

Message: 66 of 138

On 9/11/2012 10:42 AM, St.Ivanov wrote:
> dpb,
>
> I'll try your suggestions. Give me some time. Please.

Well, ok, that's fine--it seemed since there was no response other than
continuing on the same (apparently fruitless) tack the message wasn't
getting thru... :)

I just couldn't see any reason not to answer the basic question of what
it really is that were trying to accomplish (beyond just the specific
task of getting something into Excel, that is)...

I'm gone unless have some other specific; I "know nuthink'" to quote Sgt
Schultz of any depth re: signal processing; as said it was just the
SQL/Excel thing that really seemed to be a wrong path to take that got
me here at all...

--

Subject: save_subimages

From: St.Ivanov

Date: 11 Sep, 2012 16:11:08

Message: 67 of 138

 dpb,

I don't want to insult anybody !
I just want to clarify Matt's suggestion and continue (trying your suggestions).
That is all.

Subject: save_subimages

From: Matt J

Date: 11 Sep, 2012 17:53:08

Message: 68 of 138

"St.Ivanov" wrote in message <k2nmuo$ell$1@newscl01ah.mathworks.com>...
>
> > Yes, but why are you trying to write the ENTIRE array Yl to the Excel file? You seem to want each sheet to contain 64x64 data (that was the case previously, when you were putting the data in cells Yl{j}). So why are you using XLSWRITE to send the entire array Yl, which is of a much bigger size 64x64000, to every single sheet? Just pull out the subset of data from Yl that you want and pass that to xlswrite.
> ---
>
> Matt,
>
> How to apply
>
> Yl(:,:,j,i) = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
>
> for Yl is 64x64
==============

Again, you can extract a sub-chunk of data from Yl by indexing it in the normal way, e.g.,

>> A=eye(2); A(:,1),A(2,:)

ans =

     1
     0


ans =

     0 1


You can then use the RESHAPE command to get the chunk to be 64x64 or 32x128 or anything else that you want (as long as the total number of elements in the array doesn't change obviously). See "doc reshape" for full details.

Subject: save_subimages

From: Matt J

Date: 11 Sep, 2012 18:23:07

Message: 69 of 138

dpb <none@non.net> wrote in message <k2nkjq$mgp$1@speranza.aioe.org>...
> On 9/11/2012 8:38 AM, Steven_Lord wrote:
>
> I'll ask OP again--what, specifically, does he think he's going to do in
> Excel that can't be done as easy or quicker in Matlab?

@St Ivanov,

To dpb's point, it appears to me that the only reason you are exporting things to Excel is so that you can read/inspect the results. If that's the case, then it's completely unnecessary. You can open any MATLAB matrix in an Excel-like reader just be using MATLAB's variable editor. As an example:

A=rand(3,3,2);
openvar A(:,:,2)

Subject: save_subimages

From: St.Ivanov

Date: 11 Sep, 2012 21:14:07

Message: 70 of 138


> @St Ivanov,
>
> To dpb's point, it appears to me that the only reason you are exporting things to Excel is so that you can read/inspect the results.

Matt,

something like that. I want to see the result both: as values and as arrangement of the rows and columns to be sure they are in the form the DB requires.
And then transfer.

I'll try:
A=rand(3,3,2);
openvar A(:,:,2)

and see "doc reshape".

Subject: save_subimages

From: St.Ivanov

Date: 11 Sep, 2012 21:18:08

Message: 71 of 138

dpb <none@non.net> wrote in message <k2nn4n$thj$1@speranza.aioe.org>...
> On 9/11/2012 10:42 AM, St.Ivanov wrote:
> > dpb,
> >
>
> I'm gone ...

Matt,

I didn't want it to happen.
You know how I feel now.

Subject: save_subimages

From: Matt J

Date: 11 Sep, 2012 21:31:07

Message: 72 of 138

"St.Ivanov" wrote in message <k2o9qg$sa2$1@newscl01ah.mathworks.com>...
> dpb <none@non.net> wrote in message <k2nn4n$thj$1@speranza.aioe.org>...
> > On 9/11/2012 10:42 AM, St.Ivanov wrote:
> > > dpb,
> > >
> >
> > I'm gone ...
>
> Matt,
>
> I didn't want it to happen.
> You know how I feel now.

It doesn't seem to be a crisis.

Subject: save_subimages

From: dpb

Date: 11 Sep, 2012 22:31:25

Message: 73 of 138

On 9/11/2012 4:18 PM, St.Ivanov wrote:
> dpb <none@non.net> wrote in message <k2nn4n$thj$1@speranza.aioe.org>...
>> On 9/11/2012 10:42 AM, St.Ivanov wrote:
>> > dpb,
>> >
>>
>> I'm gone ...
...

> I didn't want it to happen.
> You know how I feel now.

Nothing you did; I explained I don't know anything about the rest of
your problem--if you're looking at the points I raised that's all I was
trying to get across. I just don't have anything else useful to
contribute and was simply saying I'll not bug you any more about the
other... :)

--

Subject: save_subimages

From: dpb

Date: 11 Sep, 2012 22:33:30

Message: 74 of 138

On 9/11/2012 4:14 PM, St.Ivanov wrote:
...

> something like that. I want to see the result both: as values and as
> arrangement of the rows and columns to be sure they are in the form the
> DB requires.

You can do that at the command line directly...

> And then transfer.
...

and then ditch Excel entirely... :) That's _gotta_ be a boon! :)

--

Subject: save_subimages

From: St.Ivanov

Date: 12 Sep, 2012 05:44:08

Message: 75 of 138

Matt,


"...it appears to me that the only reason you are exporting things to Excel is so that you can read/inspect the results."

Yes.
I want to 'read/inspect the results' as values and arrangement of rows and columns.

Subject: save_subimages

From: St.Ivanov

Date: 12 Sep, 2012 06:04:08

Message: 76 of 138

 dpb,

Thank you.

Subject: save_subimages

From: dpb

Date: 12 Sep, 2012 12:54:33

Message: 77 of 138

On 9/12/2012 12:44 AM, St.Ivanov wrote:
> Matt,
>
>
> "...it appears to me that the only reason you are exporting things to
> Excel is so that you can read/inspect the results."
>
> Yes.
> I want to 'read/inspect the results' as values and arrangement of rows
> and columns.

As Matt says, use the array viewer in Matlab or

doc disp

NB that using a small subset of a large matrix is generally all one
needs to confirm that order is as expected--after all, about all one can
do is to have either the correct order or the transpose in a 2D array.

If the first few rows/columns are in the correct positions then there's
virtually no way the remainder will somehow have gotten rearranged when
one is doing block movements or operations on the data.

Remember in doing this that internal storage in Matlab is column order
so that when you write data you may need to transpose arrays (in calls
to fprintf() and friends, for example).

Consider the following...such examples are easy to do to get the picture
and understand what happens between internal storage and external
display order...

 >> x=reshape([1:12],4,3) % note the column-major order!!!
x =
      1 5 9
      2 6 10
      3 7 11
      4 8 12
 >> disp(x)
      1 5 9
      2 6 10
      3 7 11
      4 8 12

 >> csvwrite('Ivanov.txt',x)
 >> type ivanov.txt

1,5,9
2,6,10
3,7,11
4,8,12

 >> delete ivanov.txt
 >> fid=fopen('ivanov.txt','wt');
 >> fprintf(fid,'%d %d %d\n',x);
 >> fid=fclose(fid);
 >> type ivanov.txt % Ooops! What happens????

1 2 3
4 5 6
7 8 9
10 11 12

 >> delete ivanov.txt
 >> fid=fopen('ivanov.txt','wt');
 >> fprintf(fid,'%d %d %d\n',x'); % nb the ' !!!
 >> fid=fclose(fid);
 >> type ivanov.txt

1 5 9
2 6 10
3 7 11
4 8 12

 >>

Anyway, you don't need Excel to discover the order the data is in and
you don't need it to import into a SQL database, either... :)

--

Subject: save_subimages

From: dpb

Date: 12 Sep, 2012 14:24:24

Message: 78 of 138

On 9/12/2012 7:54 AM, dpb wrote:
...

> Anyway, you don't need Excel to discover the order the data is in...

Excuse me--...order data _are_ in. :)

--

Subject: save_subimages

From: St.Ivanov

Date: 13 Sep, 2012 16:38:07

Message: 79 of 138

Matt,

why doesn't the following code work for level 4 but it does for level 3?

Yl=zeros(8,8,64,1000,'single');
for i = 1:1000
    inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
    load(inputFilename, 'subimages');
for j=1:64
 Yl(:,:,j,i) = dtwavexfm2(subimages{j},4,'near_sym_b','qshift_b');
end
end
save('MyFile_4','Yl');

Error message:
??? Subscripted assignment dimension mismatch.

Error in ==> Untitled16_K at 12
 Yl(:,:,j,i) = dtwavexfm2(subimages{j},4,'near_sym_b','qshift_b');

Subject: save_subimages

From: dpb

Date: 13 Sep, 2012 16:50:16

Message: 80 of 138

On 9/13/2012 11:38 AM, St.Ivanov wrote:
> Matt,
>
> why doesn't the following code work for level 4 but it does for level 3?
>
> Yl=zeros(8,8,64,1000,'single');
> for i = 1:1000
...

> Yl(:,:,j,i) = dtwavexfm2(subimages{j},4,'near_sym_b','qshift_b');
...

> Error message:
> ??? Subscripted assignment dimension mismatch.
>
> Error in ==> Untitled16_K at 12
> Yl(:,:,j,i) = dtwavexfm2(subimages{j},4,'near_sym_b','qshift_b');

I don't know what the function does but clearly it returns a different
shape result than the LHS.

Do

size(arg)

at the command line (or stop w/ debug in context) where 'arg' is the two
sides of the above assignment statement--the target subarray and the
function expression.

All will be clear as to why it fails--what you want and how to do that
is beyond my pay grade... :)

--

Subject: save_subimages

From: St.Ivanov

Date: 13 Sep, 2012 17:01:05

Message: 81 of 138

"St.Ivanov" wrote in message <k2t25f$nsr$1@newscl01ah.mathworks.com>...
> Matt,
>
> why doesn't the following code work for level 4 but it does for level 3?
>
> Yl=zeros(8,8,64,1000,'single');
> for i = 1:1000
> inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
> load(inputFilename, 'subimages');
> for j=1:64
> Yl(:,:,j,i) = dtwavexfm2(subimages{j},4,'near_sym_b','qshift_b');
> end
> end
> save('MyFile_4','Yl');
>
> Error message:
> ??? Subscripted assignment dimension mismatch.
>
> Error in ==> Untitled16_K at 12
> Yl(:,:,j,i) = dtwavexfm2(subimages{j},4,'near_sym_b','qshift_b');

---
Matt, this comes from the transformation itself.
Yl=zeros(8,8,64,1000,'single');
should be
Yl=zeros(4,4,64,1000,'single');
because of the image division.
I realized this.

Subject: save_subimages

From: St.Ivanov

Date: 13 Sep, 2012 17:30:08

Message: 82 of 138


Sorry,
I didn't say it correct: I meant multiresolution processing (instead of 'image division').

Subject: save_subimages

From: St.Ivanov

Date: 13 Sep, 2012 18:34:08

Message: 83 of 138

Matt,

Using:
A=rand(64,64,2);
openvar A(:,:,2)

in:
for i = 1:1
    inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
    load(inputFilename, 'subimages');
    Yl=cell(size(subimages)); Yh=Yl;
      for j=1:64
        [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
      end
    A=rand(64,64,2);
    openvar A(:,:,2)
end

 gives different result without changing anything every time I start the code.
Look:
0.0864/0.9550/0.2173
0.5170/0.9038/0.6197
0.4030/0.9593/0.1676
0.9819/0.1774/0.2850

The results are different from those using:
Yl=cell2mat(Yl(:).');
Yl=reshape(Yl,64,[]);
outputFilename = sprintf('%s/%02d.xls', outputFolder, i);
xlswrite(outputFilename,Yl,'Sheet1', 'A1');

These results do not change:
1.57120157 1.483057085 0.953179138
1.35300052 1.083032015 1.064505075
1.381335355 0.581427716 1.081282678
1.380988889 0.392236419 1.063675715

Which is true?
Matt, am I wrong anywhere?

Subject: save_subimages

From: dpb

Date: 13 Sep, 2012 19:16:53

Message: 84 of 138

On 9/13/2012 1:34 PM, St.Ivanov wrote:
> Matt,
>
> Using: A=rand(64,64,2);
> openvar A(:,:,2)
> in:
> for i = 1:1
...

> gives different result without changing anything every time I start the
> code....


What else but different would you expect the results from successive
calls to a PSRNG to be (w/o resetting the internal state, anyway)?

If you want to reproduce a sequence of RN's in Matlab see the discussion
on that in documentation for the version you have--TMW has changed how
that interface works from earlier releases.

--

Subject: save_subimages

From: Matt J

Date: 13 Sep, 2012 20:31:08

Message: 85 of 138

"St.Ivanov" wrote in message <k2t8v0$l19$1@newscl01ah.mathworks.com>...
> Matt,
>
> Using:
> A=rand(64,64,2);
> openvar A(:,:,2)
>
> in:
> for i = 1:1
> inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
> load(inputFilename, 'subimages');
> Yl=cell(size(subimages)); Yh=Yl;
> for j=1:64
> [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
> end
> A=rand(64,64,2);
> openvar A(:,:,2)
> end
==============

I'm not sure why you modified your code as above and, like dpb, I'm not sure what you expected to get from it. I suspect that you are following my simplified example literally, without understanding what it is doing or how to adapt it to your actual problem.

I'll elaborate a little bit, in case it helps. The statement

  A=rand(64,64,2);

simply generates a completely random array of dimensions 64x64x2. This is what the RAND command is meant for. The command

openvar A(:,:,2)

displays A(:,:,2) in the variable editor. Since A is randomly generated, it makes perfect sense that it will be different each time you run it. Furthermore, since Yl and A are different variables, it makes perfect sense that when you display A, you will not see the values of Yl.

Subject: save_subimages

From: dpb

Date: 13 Sep, 2012 21:01:19

Message: 86 of 138

On 9/13/2012 3:31 PM, Matt J wrote:
...

> I'm not sure why you modified your code as above and, like dpb, I'm not
> sure what you expected to get from it. I suspect that you are following
> my simplified example literally, without understanding what it is doing
...

Yeah, I realized that must have been the problem just _after_ I
posted...then is when I remembered you example to demonstrate the
variable editor.

Ah, well, who ever said pedagogical efforts always go smoothly? :)

--

Subject: save_subimages

From: St.Ivanov

Date: 14 Sep, 2012 05:13:10

Message: 87 of 138


>
> I'm not sure why you modified your code as above and, like dpb, I'm not sure what you expected to get from it. I suspect that you are following my simplified example literally, without understanding what it is doing or how to adapt it to your actual problem.
>
> I'll elaborate a little bit, in case it helps. The statement
>
> A=rand(64,64,2);
>
> simply generates a completely random array of dimensions 64x64x2. This is what the RAND command is meant for. The command
>
> openvar A(:,:,2)
>
> displays A(:,:,2) in the variable editor. Since A is randomly generated, it makes perfect sense that it will be different each time you run it. Furthermore, since Yl and A are different variables, it makes perfect sense that when you display A, you will not see the values of Yl.
---
Matt,
I just want to read/inspect the results.
Maybe this is true:
'...how to adapt it to your actual problem.'
There is something that I don't realize.

Subject: save_subimages

From: St.Ivanov

Date: 14 Sep, 2012 05:22:09

Message: 88 of 138


Matt,
'I'm not sure why you modified your code as above'
I didn't modify. I only went back to this version to see how
A=rand(64,64,2);
> openvar A(:,:,2)

worked and what results would produce. And since I had the results written in Excel, I would compare them both. Just to ensure that I worked correct. And then, I would continue with the other transformation version.

Subject: save_subimages

From: Matt J

Date: 14 Sep, 2012 08:01:15

Message: 89 of 138

"St.Ivanov" wrote in message <k2ued6$t4m$1@newscl01ah.mathworks.com>...
>
> Matt,
> I just want to read/inspect the results.
> Maybe this is true:
> '...how to adapt it to your actual problem.'
> There is something that I don't realize.
===============

When you see code you don't understand, you should be using HELP or DOC to learn what they do.

Subject: save_subimages

From: St.Ivanov

Date: 14 Sep, 2012 16:16:08

Message: 90 of 138

Matt,

> When you see code you don't understand, you should be using HELP or DOC to learn what they do.

I do READ and TRY. I'm not agrre with your contention.
And even though there is something that I do not realize.

Subject: save_subimages

From: St.Ivanov

Date: 14 Sep, 2012 16:18:07

Message: 91 of 138

Matt,

Besides, If you know what thinking it is...- one of a kind.

Subject: save_subimages

From: St.Ivanov

Date: 14 Sep, 2012 17:53:05

Message: 92 of 138

Matt,

I extracted the coefficients for i=1 and they coincided with the previous ones.
Then, I used 'reshape' to arrange the rows and columns.
But what bothers me is that nobody knows what happens for i=1:1000.
The results still cannot be explained.

Subject: save_subimages

From: dpb

Date: 14 Sep, 2012 18:08:54

Message: 93 of 138

On 9/14/2012 12:53 PM, St.Ivanov wrote:
...

> But what bothers me is that nobody knows what happens for i=1:1000.
> The results still cannot be explained.

What results are those? That you were trying to write a humongously
large array into Excel? There's undoubtedly an explanation if the
problem/question is formulated clearly.

--

Subject: save_subimages

From: Matt J

Date: 14 Sep, 2012 18:20:08

Message: 94 of 138

"St.Ivanov" wrote in message <k2vqu1$aih$1@newscl01ah.mathworks.com>...
> Matt,
>
> I extracted the coefficients for i=1 and they coincided with the previous ones.
> Then, I used 'reshape' to arrange the rows and columns.
> But what bothers me is that nobody knows what happens for i=1:1000.
> The results still cannot be explained.
==========

Lost you. What don't we know about i=1:1000?

Subject: save_subimages

From: St.Ivanov

Date: 14 Sep, 2012 19:04:07

Message: 95 of 138


> Lost you. What don't we know about i=1:1000?
---
Matt,
'What don't we know about i=1:1000?'- I don't know what you don't know. I hope we won't misunderstand again.

Take a look at this:
for i = 1:1
    inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
    load(inputFilename, 'subimages');
    Yl=cell(size(subimages)); Yh=Yl;
   for j=1:64
  [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
end
Yl=reshape(Yl,64,[]);
openvar ('Yl')
end

The result in the variable editor is literally:
64x1 with the values I need in each cell (8x8 double). The logic doesn't break.
But if I set i=1:1000
it is 64x1 again, each cell is 8x8 double but the values in it have no explanation.
Do you have any idea what happens for all the 1000 images?
How the results for them should appear?

Subject: save_subimages

From: St.Ivanov

Date: 14 Sep, 2012 19:28:07

Message: 96 of 138

To be more clear:
'but the values in it have no explanation.'- they are not recognizable.

Subject: save_subimages

From: Matt J

Date: 14 Sep, 2012 19:34:08

Message: 97 of 138

"St.Ivanov" wrote in message <k2vv37$r0s$1@newscl01ah.mathworks.com>...
>
> > Lost you. What don't we know about i=1:1000?
> ---
> Matt,
> 'What don't we know about i=1:1000?'- I don't know what you don't know. I hope we won't misunderstand again.
>
> Take a look at this:
> for i = 1:1
> inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
> load(inputFilename, 'subimages');
> Yl=cell(size(subimages)); Yh=Yl;
> for j=1:64
> [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');
> end
> Yl=reshape(Yl,64,[]);
> openvar ('Yl')
> end
>
> The result in the variable editor is literally:
> 64x1 with the values I need in each cell (8x8 double). The logic doesn't break.
> But if I set i=1:1000
> it is 64x1 again, each cell is 8x8 double but the values in it have no explanation.
> Do you have any idea what happens for all the 1000 images?
> How the results for them should appear?

Yl is changing with i. New files are being read in as i increases throughout the loop and the previous Yl gets overwritten. I expect that if you loop over i=1:1000, then Yl will be the same in the editor as i=1000.

Subject: save_subimages

From: dpb

Date: 14 Sep, 2012 19:46:02

Message: 98 of 138

On 9/14/2012 2:28 PM, St.Ivanov wrote:
> To be more clear:
> 'but the values in it have no explanation.'- they are not recognizable.

"Even their mothers don't know them...." :)

Well, I've no clue what the function is actually doing, but nowhere in
the loop are you saving anything as a function of the index 'i' so each
pass thru you're overwriting the previous.

Now what the last set of data looks like which is what you will have at
the very end, only you can know...perhaps what's in the files themselves
isn't what you think it is--been known to happen.

But, if you're trying to save all of these separate ones individually,
then you need to increment a storage location on 'i'

--

Subject: save_subimages

From: Matt J

Date: 14 Sep, 2012 19:54:08

Message: 99 of 138

"St.Ivanov" wrote in message <k2vv37$r0s$1@newscl01ah.mathworks.com>...
>
>
> But if I set i=1:1000
> it is 64x1 again, each cell is 8x8 double but the values in it have no explanation.
> Do you have any idea what happens for all the 1000 images?
> How the results for them should appear?
=================


Study the following 2 statements and make sure you understand why their results are different,

>> clear Yl; for ii=1:3, Yl=ii; end, Yl

Yl =

     3

>> clear Yl; for ii=1:3, Yl{ii}=ii; end, Yl

Yl =

    [1] [2] [3]

Subject: save_subimages

From: St.Ivanov

Date: 14 Sep, 2012 19:57:08

Message: 100 of 138

Matt,
'I expect that if you loop over i=1:1000, then Yl will be the same in the editor as i=1000.'
You are right.

Subject: save_subimages

From: St.Ivanov

Date: 14 Sep, 2012 19:59:09

Message: 101 of 138

"Matt J" wrote in message <k30210$9fn$1@newscl01ah.mathworks.com>...
> "St.Ivanov" wrote in message <k2vv37$r0s$1@newscl01ah.mathworks.com>...
> >
> >
> > But if I set i=1:1000
> > it is 64x1 again, each cell is 8x8 double but the values in it have no explanation.
> > Do you have any idea what happens for all the 1000 images?
> > How the results for them should appear?
> =================
>
>
> Study the following 2 statements and make sure you understand why their results are different,
>
> >> clear Yl; for ii=1:3, Yl=ii; end, Yl
>
> Yl =
>
> 3
>
> >> clear Yl; for ii=1:3, Yl{ii}=ii; end, Yl
>
> Yl =
>
> [1] [2] [3]

---
I will.

Subject: save_subimages

From: St.Ivanov

Date: 14 Sep, 2012 20:15:08

Message: 102 of 138

Matt,
Yl{ii}=ii
in different cells?

Subject: save_subimages

From: St.Ivanov

Date: 14 Sep, 2012 20:22:07

Message: 103 of 138

And you suggest using this logic:
>
> >> clear Yl; for ii=1:3, Yl{ii}=ii; end, Yl
>
> Yl =
>
> [1] [2] [3]

?

Subject: save_subimages

From: Matt J

Date: 14 Sep, 2012 20:28:07

Message: 104 of 138

"St.Ivanov" wrote in message <k303lf$g4i$1@newscl01ah.mathworks.com>...
> And you suggest using this logic:
> >
> > >> clear Yl; for ii=1:3, Yl{ii}=ii; end, Yl
> >
> > Yl =
> >
> > [1] [2] [3]
>
> ?

The point is that Y{ii}=ii illustrates ONE way of saving results from every iteration ii=1:3, if that's what you want to do

Subject: save_subimages

From: St.Ivanov

Date: 14 Sep, 2012 20:37:07

Message: 105 of 138

"Matt J" wrote in message <k3040n$hd4$1@newscl01ah.mathworks.com>...
> "St.Ivanov" wrote in message <k303lf$g4i$1@newscl01ah.mathworks.com>...
> > And you suggest using this logic:
> > >
> > > >> clear Yl; for ii=1:3, Yl{ii}=ii; end, Yl
> > >
> > > Yl =
> > >
> > > [1] [2] [3]
> >
> > ?
>
> The point is that Y{ii}=ii illustrates ONE way of saving results from every iteration ii=1:3, if that's what you want to do
---
I do.

Subject: save_subimages

From: dpb

Date: 14 Sep, 2012 21:42:10

Message: 106 of 138

On 9/14/2012 3:37 PM, St.Ivanov wrote:
> "Matt J" wrote in message <k3040n$hd4$1@newscl01ah.mathworks.com>...
>> "St.Ivanov" wrote in message <k303lf$g4i$1@newscl01ah.mathworks.com>...
>> > And you suggest using this logic:
>> > > > > >> clear Yl; for ii=1:3, Yl{ii}=ii; end, Yl
>> > > > > Yl = > > > > [1] [2] [3]
>> > > ?
>>
>> The point is that Y{ii}=ii illustrates ONE way of saving results from
>> every iteration ii=1:3, if that's what you want to do
> ---
> I do.

OK, I'll be devil's advocate (again)... :)

Why do you need them all at once instead of processing, disposing of,
each one then going on to the next? What are you going to do w/ them
all that you can't do individually?

Certainly after you verify that the data are being processed correctly
in a few iterations, it doesn't take every single one _at_the_same_time_
to verify each iteration does the same thing.

The point is, why use up memory just for the sake of doing so and making
an application a resource hog it doesn't need to be (unless, of course,
there really is a fundamental reason)?

--

Subject: save_subimages

From: Steven_Lord

Date: 14 Sep, 2012 21:42:42

Message: 107 of 138



"St.Ivanov " <sstar_05@hotmail.com> wrote in message
news:k2vv37$r0s$1@newscl01ah.mathworks.com...
>
>> Lost you. What don't we know about i=1:1000?
> ---
> Matt,
> 'What don't we know about i=1:1000?'- I don't know what you don't know. I
> hope we won't misunderstand again.
>
> Take a look at this:
> for i = 1:1
> inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
> load(inputFilename, 'subimages'); Yl=cell(size(subimages)); Yh=Yl; for
> j=1:64
> [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b'); end
> Yl=reshape(Yl,64,[]);
> openvar ('Yl') end
> The result in the variable editor is literally:
> 64x1 with the values I need in each cell (8x8 double). The logic doesn't
> break.
> But if I set i=1:1000
> it is 64x1 again, each cell is 8x8 double but the values in it have no
> explanation.
> Do you have any idea what happens for all the 1000 images?

Each iteration through your outer "for i" loop, you do the following:
overwrite inputFilename, "poof" data from the subimages variable stored in a
MAT-file into the workspace (Bad Idea BTW), overwrite Yl and Yh with new
cell arrays, fill in those cell arrays inside the "for j" loop, then reshape
Yl and open the current iteration's version of Yl in the Variable Editor.

> How the results for them should appear?

If you want to store _each iteration's Yl_ so that at the end you can see
all of them? Before your loop create a cell array to store the results:

resultsForEachIteration = cell(1, upperLimitOfTheLoopOveri); % For an
appropriate value for upperLimitOfTheLoopOveri

Then during each iteration, copy that iteration's version of Yl into the ith
cell of resultsForEachIteration.

resultsForEachIteration{i} = Yl;

After the outer loop is done, pull out the result for whatever iteration you
want.

resultsFromIteration5 = resultsForEachIteration{5};

--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: save_subimages

From: Matt J

Date: 15 Sep, 2012 00:42:07

Message: 108 of 138

"St.Ivanov" wrote in message <k304hj$jel$1@newscl01ah.mathworks.com>...
>
> >
> > The point is that Y{ii}=ii illustrates ONE way of saving results from every iteration ii=1:3, if that's what you want to do
> ---
> I do.
=============


Also, be aware of things like this:


>> Yl=zeros(2,2,3); for ii=1:3, Yl(:,1,ii)=ii;end, Yl

Yl(:,:,1) =

     1 0
     1 0


Yl(:,:,2) =

     2 0
     2 0


Yl(:,:,3) =

     3 0
     3 0

Subject: save_subimages

From: St.Ivanov

Date: 15 Sep, 2012 17:37:08

Message: 109 of 138


Steve,

would you explain why you think

> overwrite inputFilename, "poof" data from the subimages variable stored in a
> MAT-file into the workspace

is a bad idea?
What do you exactly mean?

Subject: save_subimages

From: Matt J

Date: 15 Sep, 2012 18:04:08

Message: 110 of 138

"St.Ivanov" wrote in message <k32ec4$kjo$1@newscl01ah.mathworks.com>...
>
> Steve,
>
> would you explain why you think
>
> > overwrite inputFilename, "poof" data from the subimages variable stored in a
> > MAT-file into the workspace
>
> is a bad idea?
> What do you exactly mean?
============

You should really always call LOAD with an output argument

S=load(inputFilename, 'subimages');
subimages=S.subimages;

When you don't do this, strange things can happen. If you try putting the following functions in an mfile and running it, you should see what I mean


function test

fft=1; save tst fft;
subtest

function subtest

load tst
y=fft+1,

Subject: save_subimages

From: St.Ivanov

Date: 15 Sep, 2012 18:14:08

Message: 111 of 138

Thank you, Matt.
I'll try it by all means.

Subject: save_subimages

From: St.Ivanov

Date: 15 Sep, 2012 19:42:07

Message: 112 of 138


Matt,

> function test
>
> fft=1; save tst fft;
> subtest
>
> function subtest
>
> load tst
> y=fft+1
---
Hah,
not enough input arguments?

Subject: save_subimages

From: Matt J

Date: 15 Sep, 2012 20:02:07

Message: 113 of 138

"St.Ivanov" wrote in message <k32lmf$egs$1@newscl01ah.mathworks.com>...
>
> Matt,
>
> > function test
> >
> > fft=1; save tst fft;
> > subtest
> >
> > function subtest
> >
> > load tst
> > y=fft+1
> ---
> Hah,
> not enough input arguments?

Yes. Inside subtest(), MATLAB think that 'fft' is a call to the FFT command instead of a variable loaded from tst.mat

Subject: save_subimages

From: Matt J

Date: 15 Sep, 2012 20:04:08

Message: 114 of 138

"St.Ivanov" wrote in message <k32lmf$egs$1@newscl01ah.mathworks.com>...
>
> Matt,
>
> > function test
> >
> > fft=1; save tst fft;
> > subtest
> >
> > function subtest
> >
> > load tst
> > y=fft+1
> ---
> Hah,
> not enough input arguments?

Now try this:


function test

fft=1;
save tst fft;
subtest

function subtest

S=load('tst');
fft=S.fft;

y=fft+1,

Subject: save_subimages

From: St.Ivanov

Date: 15 Sep, 2012 21:19:08

Message: 115 of 138

Matt,

y =

     2

Subject: save_subimages

From: St.Ivanov

Date: 15 Sep, 2012 21:26:07

Message: 116 of 138

Clear Matt,

I've modified the code.

Subject: save_subimages

From: St.Ivanov

Date: 16 Sep, 2012 11:55:07

Message: 117 of 138

Matt,

I found Steve's suggestion simpler and more sensitive and tried to apply it.
I hope you don't mind.
But I'm already tired of overwriting.
Here is how I think:
First, I define the cell array for result storing and set it to upper limit=1000
resultsForEachIteration = cell(1, 1000)
Then, I go to the outer loop (for i=1:1000) and after that go through the inner one (for j=1:64). Going out of it I have to write the result into a cell which number coincides the number of the current iteration.
Finally, after the outer loop finishes I have to pull out the result for whatever 'i'.
For i=1 the result should be one, for i=50 the result should be other and so on.
Unfortunately, only the result for i=1000 appears.
Where do I break?
Here is the code:

resultsForEachIteration = cell(1, 1000);
for i = 1:1000
    inputFilename = sprintf('%s/%02d.mat', inputFolder, i);
    S=load(inputFilename, 'subimages');
    subimages=S.subimages;
    Yl=cell(size(subimages)); Yh=Yl;
   
for j=1:64
  [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');%3
end

resultsForEachIteration{i} = Yl;
end
resultsFromIteration1 = resultsForEachIteration{1};
Yl=reshape(Yl,[],64);%64
openvar ('Yl')


 

Subject: save_subimages

From: Matt J

Date: 16 Sep, 2012 12:42:08

Message: 118 of 138

"St.Ivanov" wrote in message <k34emr$gsu$1@newscl01ah.mathworks.com>...
>
> resultsForEachIteration{i} = Yl;
> end
> resultsFromIteration1 = resultsForEachIteration{1};
> Yl=reshape(Yl,[],64);%64
> openvar ('Yl')
============


I'm guessing that you really want

Yl=reshape(resultsFromIteration1,[],64);%64
openvar ('Yl')


or,


Yl=reshape(resultsForEachIteration{1},[],64);%64
openvar ('Yl')

Subject: save_subimages

From: Karthik

Date: 16 Sep, 2012 13:54:08

Message: 119 of 138

Hello Matt J,

I am working in Medical Image Processing. I want to segment a lung image so that i can extract the Left and Right region alone...

I Started working on that and i was able to obtain a black and white lung image..
I=imread('C:\myimages\lung.jpg');
figure(1),title('Original image'),
imshow(I);
I=rgb2gray(I);
Y=medfilt2(I);
title('Noise Removed image'),figure(2);
imshow(Y);
imwrite(Y,'newimage.jpg','JPEG');

I = imread('newimage.jpg');
[x,y]=size(I);
b=double(I);
m=max(max(I));
n=min(min(I));

T=(m+n)/2;
temp=0;
S0=0.0; n0=0.0;
S1=0.0; n1=0.0;
p=10;
d=abs(T-temp);
count=0;
while(d>=p)
    count=count+1;
    for i=1:x,
        for j=1:y,
            if I(i,j)>=T,
                S0=S0+b(i,j);
                n0=n0+1;
            end
            if I(i,j)<T,
                S1=S1+b(i,j);
                n1=n1+1;
            end
        end
    end
    T0=S0/n0;
    T1=S1/n1;
    temp=(T0+T1)/2;
    d=abs(T-temp);
    T=temp;
end
i1=im2bw(I);
figure(3),title('Thresholded image'),imshow(i1)
..

And out of this code i could get that.. But now i get additional portions in lung image which i dont want. I want to remove all those and obtain those lung region along with those tissues alone..
So can u pl help me to proceed....
If the image is required i ve attached it in th following link..

http://www.4shared.com/account/dir/q6FRTGYe/_online.html.

It would be very nice if i could get ur help sir...
Thank you,
Karthik.





"Matt J" wrote in message <k2058j$k8u$1@newscl01ah.mathworks.com>...
> "St.Ivanov" wrote in message <k1vtkp$pm5$1@newscl01ah.mathworks.com>...
> >
> > Or even:
> >
> > for p=1:1000
> > > for i=1:64
> > >
> > > [Yl{i},Yh{i}] = dtwavexfm2(subimages{i},3,'near_sym_b','qshift_b');
> > >
> > > end
> > > end
>
>
> Yes. I think this should work.

Subject: save_subimages

From: St.Ivanov

Date: 16 Sep, 2012 14:24:08

Message: 120 of 138


> I'm guessing that you really want
>
> Yl=reshape(resultsFromIteration1,[],64);%64
> openvar ('Yl')
>
>
> or,
>
>
> Yl=reshape(resultsForEachIteration{1},[],64);%64
> openvar ('Yl')
---
Most of all.
---
Matt, it works.

Subject: save_subimages

From: St.Ivanov

Date: 16 Sep, 2012 16:22:06

Message: 121 of 138

Matt,

I 'm a little bit worried about the results, the DB and data transfer. There is something that bothers me.
That's why I want to see the results using your approach too and assess the situation.

Here is what I tried :
inputFolder = 'Subimages MAT files';
outputFolder = 'Excel files 2';

for ii = 1:1000
    inputFilename = sprintf('%s/%02d.mat', inputFolder, ii);
    S=load(inputFilename, 'subimages');
    subimages=S.subimages;
    Yl=cell(size(subimages)); Yh=Yl;
 for j=1:64
  [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');%3
 end
Yl{ii}=ii;
end
Yl=reshape(Yl{ii},[],64);%64
openvar ('Yl')

Error Message:
??? Error using ==> reshape
Product of known dimensions, 64, not divisible into total number of elements, 1.

Error in ==> Untitled16_Kingsbury2_M at 54
Yl=reshape(Yl{ii},[],64);%64

?

Subject: save_subimages

From: Matt J

Date: 16 Sep, 2012 16:58:07

Message: 122 of 138

"St.Ivanov" wrote in message <k34ube$7r5$1@newscl01ah.mathworks.com>...
>
> Yl{ii}=ii;

Why is this here?



> Error in ==> Untitled16_Kingsbury2_M at 54
> Yl=reshape(Yl{ii},[],64);%64
=============

You cannot reshape a scalar to have 64 columns. Notice:

>> reshape(1,[],64)
Error using reshape
Product of known dimensions, 64, not divisible into total number of elements, 1.


 

Subject: save_subimages

From: St.Ivanov

Date: 16 Sep, 2012 17:44:08

Message: 123 of 138

Matt,

> > Yl{ii}=ii;
>
> Why is this here?
---
are you sure that I realize the meaning of Yl{ii}=ii:
"Yl{ii}=ii
in different cells? "

As far as:
> > Error in ==> Untitled16_Kingsbury2_M at 54
> > Yl=reshape(Yl{ii},[],64);%64
> =============
>
> You cannot reshape a scalar to have 64 columns. Notice:
>
> >> reshape(1,[],64)
> Error using reshape
> Product of known dimensions, 64, not divisible into total number of elements, 1.

I'm agree. I'll get rid of this little likeable error somehow.

Matt, I'm not sure I think correct at all.

Subject: save_subimages

From: Matt J

Date: 16 Sep, 2012 17:59:08

Message: 124 of 138

"St.Ivanov" wrote in message <k35358$mrj$1@newscl01ah.mathworks.com>...
> Matt,
>
> > > Yl{ii}=ii;
> >
> > Why is this here?
> ---
> are you sure that I realize the meaning of Yl{ii}=ii:
> "Yl{ii}=ii
> in different cells? "
=============

No, I'm not sure you do, but if you don't know, I think you haven't spent enough time yet with the MATLAB "Getting Started" documentation

http://www.mathworks.com/videos/introducing-structures-and-cell-arrays-68992.html

http://www.mathworks.com/videos/working-with-arrays-in-matlab-69022.html

Subject: save_subimages

From: St.Ivanov

Date: 16 Sep, 2012 18:02:08

Message: 125 of 138

Matt,
something happened:
take a look:
inputFolder = 'Subimages MAT files';
outputFolder = 'Excel files 2';
for ii = 1:2%1000
    inputFilename = sprintf('%s/%02d.mat', inputFolder, ii);
    S=load(inputFilename, 'subimages');
    subimages=S.subimages;
    Yl=cell(size(subimages)); Yh=Yl;
    Yl{ii}=ii;
for j=1:64
  [Yl{j},Yh{j}] = dtwavexfm2(subimages{j},3,'near_sym_b','qshift_b');%3
end
      Yl=Yl{ii};
end
Yl=reshape(Yl,[],64);%64
openvar ('Yl')

The result is:
for ii=1 I have the result for image 1 only its first subimage;
for ii=1:2 I have the result for image 2 only its second subimage;
I'm wrong with indexing somewhere, am I not?

Subject: save_subimages

From: dpb

Date: 16 Sep, 2012 18:15:22

Message: 126 of 138

On 9/16/2012 1:02 PM, St.Ivanov wrote:
> Matt,
> something happened:
> take a look:
...

> The result is:
> for ii=1 I have the result for image 1 only its first subimage;
> for ii=1:2 I have the result for image 2 only its second subimage;
> I'm wrong with indexing somewhere, am I not?

I'd suggest a session w/

doc debug

and, as Matt says, work through "Getting Started" until that is clear.
You are expecting others to debug for you; you've been at this for over
a week already...

--

Subject: save_subimages

From: St.Ivanov

Date: 16 Sep, 2012 18:29:08

Message: 127 of 138

 dpb,
> You are expecting others to debug for you; you've been at this for over
> a week already...
---
Avoid blaming.
I reject your allegation.
DO NOT work people against each other.
I'm not sure if you were in my shoes, you would do it better.
If you want to help, I'll appreciate it.

Subject: save_subimages

From: St.Ivanov

Date: 16 Sep, 2012 19:03:08

Message: 128 of 138


> DO NOT work people up against each other.

Subject: save_subimages

From: dpb

Date: 16 Sep, 2012 19:08:44

Message: 129 of 138

On 9/16/2012 1:29 PM, St.Ivanov wrote:
...

> want to help, I'll appreciate it.

Done already did... :)

--

Subject: save_subimages

From: Matt J

Date: 16 Sep, 2012 19:50:07

Message: 130 of 138

"St.Ivanov" wrote in message <k35470$qc9$1@newscl01ah.mathworks.com>...
>
> I'm wrong with indexing somewhere, am I not?
=============

Yes.

Subject: save_subimages

From: Matt J

Date: 16 Sep, 2012 21:05:07

Message: 131 of 138

"St.Ivanov" wrote in message <k355pk$1ue$1@newscl01ah.mathworks.com>...
>
> I reject your allegation.
==========

Well, I for one, reject the allegation as well. I don't think you're trying to get other people to debug for you. I think you're just trolling, i.e., intentionally posting random, broken code in an effort to stretch out the thread.

No one who seriously wanted their code to work for an actual project would spend 2 weeks on this when they had a working version 80 posts ago.

Subject: save_subimages

From: St.Ivanov

Date: 17 Sep, 2012 06:08:08

Message: 132 of 138

Matt,

> Well, I for one, reject the allegation as well. I don't think you're trying to get other people to debug for you. I think you're just trolling, i.e., intentionally posting random, broken code in an effort to stretch out the thread.
>
> No one who seriously wanted their code to work for an actual project would spend 2 weeks on this when they had a working version 80 posts ago.
---
I do have 2 working versions. But I try to represent the data the best way for the DB structure.
I'm here to solve problems not to argue with anybody or 'intentionally posting random, broken code in an effort to stretch out the thread'.

Subject: save_subimages

From: Steven_Lord

Date: 17 Sep, 2012 14:31:57

Message: 133 of 138



"St.Ivanov " <sstar_05@hotmail.com> wrote in message
news:k32ec4$kjo$1@newscl01ah.mathworks.com...
>
> Steve,
>
> would you explain why you think
>> overwrite inputFilename, "poof" data from the subimages variable stored
>> in a MAT-file into the workspace
>
> is a bad idea?
> What do you exactly mean?

Poofing, whether by LOADing or by EVALing, can cause unexpected behavior.


function poofByEval
% "Poof" a variable named beta into the workspace at runtime
eval('beta = magic(3);')
% Note that element (3, 3) is 2 and all elements are integer values
disp(magic(3))
% So this next line should return 2, right?
beta(3, 3)
% Huh???
% The previous line was treated as a call to this special function
help beta
% not a reference to the variable that didn't exist (and MATLAB
% didn't know about) until runtime


--
Steve Lord
slord@mathworks.com
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: save_subimages

From: St.Ivanov

Date: 18 Sep, 2012 16:02:08

Message: 134 of 138

Thank you, Steve.

Subject: save_subimages

From: St.Ivanov

Date: 18 Sep, 2012 17:29:08

Message: 135 of 138

Matt,

I applied your transformation and it ran with no errors.
I arranged the results in 64x64 (double) for level 3 and in 16x64 (double) for level 4 .
But now I have two more questions on result representation:
1. how can I pull out the result for each iteration separately (without pulling out the results of the previous iterations before it)?
2. is there any way to name each of the columns (from 'subimage 1' to 'subimage 64')
in the first row of the results and represent them from the second one on.

Subject: save_subimages

From: St.Ivanov

Date: 19 Sep, 2012 05:28:11

Message: 136 of 138

Matt,

I would't like to back but the only thing I would like to say is:
I'm sorry !

Stella

Subject: save_subimages

From: St.Ivanov

Date: 19 Sep, 2012 05:58:12

Message: 137 of 138

Matt,
I feel very badly...and try not to think of this case.
I DO trust you !
And I DON'T want to insult you !

Subject: save_subimages

From: St.Ivanov

Date: 19 Sep, 2012 06:07:16

Message: 138 of 138

Matt,
on
'intentionally posting random, broken code in an effort to stretch out the thread.'
I still feel embarassed that this thread is so long (though I know that If I'm wrong somewhere about the rules you and Steve would tell me). That is why I responded to you this way.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
medical image proc... Karthik 16 Sep, 2012 09:59:10
rssFeed for this Thread

Contact us