Search Comments and Ratings

go

   
Date File Comment by Comment Rating
11 Feb 2015 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Naveen Gowdayyanadoddi

Excellent function. Works fine for me.

5
06 Feb 2015 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Tero

Tero (view profile)

5
24 Nov 2014 Replace strings in text file REPLACEINFILE replaces characters in ASCII file using PERL Author: Pekka Kumpulainen Paul Macey

5
06 Oct 2014 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen FeedMeImATroll

Excellent function, thanks. The one thing I am missing: Is there a way to connect different subplots, as in subplot(4,2,[1,3,5])?

Comment only
19 Aug 2014 Colored line or scatter plot Plot lines with CData, (actually surface) Author: Pekka Kumpulainen Julian

Julian (view profile)

I found this technique very useful. It seemed relevant to the discussion at
http://blogs.mathworks.com/videos/2014/08/12/coloring-a-line-based-on-height-gradient-or-some-other-value-in-matlab/#comment-41206
where I posted a comment referencing to this submission. Thanks.

5
19 Feb 2014 Replace strings in text file REPLACEINFILE replaces characters in ASCII file using PERL Author: Pekka Kumpulainen Steven

Steven (view profile)

I had trouble replacing some trouble when the string I wanted to replace had '.' symbol. I am using MATLAB 2013b on Ubuntu 12.04 kernel 3.2.0-58-generic.

I ran the function like this:
>> replaceinfile('.iq','.buf','file1.txt','file2.txt')

This function worked correctly for one line of my file (the one I wanted to change):

sOpt.suffix = '.iq';

became

sOpt.suffix = '.buf';

The problem occurred for this line (which I did not want to change):

sOpt.datadir = 'iqdata/';

became

sOpt.datadir = .bufdata/';

I found I had no problems if I ran the function either of the following ways:
>> replaceinfile('\.iq','\.buf','iqpro_setup.txt','test.txt')
>> replaceinfile('\.iq','.buf','iqpro_setup.txt','test.txt')

Maybe this is a trait of PERL, not sure. Thought I'd share on the off chance that anyone else runs into that problem.

Thanks for the code.

5
13 Jan 2014 MY_XTICKLABELS Replaces XTickLabels with "normal" texts accepting multiline texts and TEX interpreting Author: Pekka Kumpulainen Liaofan Lin

5
11 Nov 2013 Replace strings in text file REPLACEINFILE replaces characters in ASCII file using PERL Author: Pekka Kumpulainen Jose

Jose (view profile)

Works very well, I am using it to generate a batch of files from a single template. I am replacing two strings in a template and creating a file everytime. Is there a way to replace multiple strings in one shot?
The way I do it now is:
1. Open template, replace first string, save with new name.
2. Open new file, replace second string.

5
19 Sep 2013 Replace strings in text file REPLACEINFILE replaces characters in ASCII file using PERL Author: Pekka Kumpulainen Phillip

Great. This was just what I needed. I added a multiselect uidetfile beforehand so I could do a batch replace on a large number of files and it worked perfectly.
---
[files] = uigetfile('*.txt','multiselect','on');

cnt = length(files);

for i = 1:cnt
s = replaceinfile(oldStr,newStr,files{i});
end

5
29 Aug 2013 Colored line or scatter plot Plot lines with CData, (actually surface) Author: Pekka Kumpulainen Yilong Jia

Works pretty well for my system. Thanks!

5
03 Aug 2013 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen hadi

hadi (view profile)

5
17 Jul 2013 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Petter

Petter (view profile)

tnx, great job

5
16 Jul 2013 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Enrico Fonda

5
07 Jun 2013 Bullshit Bingo Interactive Bullshit Bingo, right click on background for new Author: Pekka Kumpulainen Mikhail Erofeev

5
07 Jun 2013 MY_XTICKLABELS Replaces XTickLabels with "normal" texts accepting multiline texts and TEX interpreting Author: Pekka Kumpulainen Mikhail Erofeev

5
15 May 2013 Replace strings in text file REPLACEINFILE replaces characters in ASCII file using PERL Author: Pekka Kumpulainen Kevin J. Delaney

Fantastic! Just what I was looking for & it works great.

5
23 Apr 2013 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Rina

Rina (view profile)

5
13 Apr 2013 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Panagiotis Papagiannopoulos

this file really helped me! however i have one question. i want to set fixed limits of the x,y axis in each subplot.For example: (axis([0 700 -500 10000])).i tried to do it but with no result. any advice of how can i do this?

5
11 Mar 2013 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Ahmed Fasih

5
04 Mar 2013 MY_XTICKLABELS Replaces XTickLabels with "normal" texts accepting multiline texts and TEX interpreting Author: Pekka Kumpulainen dzq

dzq (view profile)

Tanks! You're a good guy.

Comment only
18 Jan 2013 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Beth

Beth (view profile)

5
11 Jan 2013 Replace strings in text file REPLACEINFILE replaces characters in ASCII file using PERL Author: Pekka Kumpulainen Kokop

Kokop (view profile)

Congrat! good script.
Only i have one question. how to use this script with multiples files? For example i have a several files in format txt in one directory, like: 31.txt, 32.txt, 33.txt... etc
there is a way to use this script for change in all the files the commas ',' to points '.'?
Thanks in advance for your help!

Comment only
27 Dec 2012 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Felipe G. Nievinski

It's great that it offers variable outer margins in addition to inner gaps. I wish it could support asymmetric plots, where a panel spans multiple rows/columns, though.

4
12 Dec 2012 Replace strings in text file REPLACEINFILE replaces characters in ASCII file using PERL Author: Pekka Kumpulainen Simon Funder

Very neat script - exactly what I was looking for. One request for a modification though:

Is it possible to specify exact lines in the input file that the script shall apply to, so e.g. find and replace is only done in the first 10 lines of my input file?

Cheers,
Simon

5
30 Nov 2012 Replace strings in text file REPLACEINFILE replaces characters in ASCII file using PERL Author: Pekka Kumpulainen Julius

Julius (view profile)

When I want to replace the string "AB.12345" with "AB.54321", the function also replaces "AB-12345", which are also in the original ASCII file with "AB.54321". This was not my intention. Can the author fix this?

4
01 Nov 2012 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Lucas Koorneef

5
26 Oct 2012 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Philip Valencia

Nice, very handy, though by default I prefer my tick labels left on... others who want this might just mod the file.. just remove in the inner loop where it sets the ticks off... i.e.

for ix = 1:Nw
ii = ii+1;
ha(ii) = axes('Units','normalized', ...
'Position',[px py axw axh]);
px = px+axw+gap(2);
end

5
22 Oct 2012 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Thomas

Thomas (view profile)

4
17 Sep 2012 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Gal Haspel

useful and does what it claims

5
16 Aug 2012 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Giovanni

This is a great script. I'm experiencing a bug that makes my ticks disappear. Here's a sample:

figure('position',[100 100 1000 600])
ha=tight_subplot(1,3,[.02,.02],[.12,.08],[.1,.02]);
for a=ha'
hold(a,'all')
box(a,'on')
xlim(a,[.1 10])
ylim(a,[-90 10])
end
set(ha,'xscale','log','fontsize',fontSize,'ytick',-100:10:20,'yticklabel',[],'yminortick','on')
set(ha(1),'yticklabel',-100:10:20)
% 1
scatter(ha(1),x11,10*log10(y11),30,[0 .5 0],'x');
scatter(ha(1),x12,10*log10(y12),30,[0 0 1],'filled');
% 2
scatter(ha(2),x21,10*log10(y21),30,[0 .5 0],'x');
scatter(ha(2),x22,10*log10(y22),30,[0 0 1],'filled');
% 3
scatter(ha(3),x31,10*log10(y31),30,[0 .5 0],'x');
scatter(ha(3),x32,10*log10(y32),30,[0 0 1],'filled');

I would expect to see xticks at .1, 1 and 10, but on my system they simply disappear. If I tried and add them manually the log scale gets screwed up, so there's gotta be another way around. I'm using Matlab R2012a.
Thanks!

4
09 Jul 2012 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Marin

Marin (view profile)

Really excellent file, thank you. Maybe an extra example wouldn't be a bad idea in the comments for the new Matlab user to better learn to use this file.

I have two questions though if I may ask them here...

1. How do i add numbers on the y axis? (only on the rightmost side of course)

2. How do I write x & y labels? (only one that applies to all axis)

Thank you in advance.

5
02 Jul 2012 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen alexpapi

5
28 Jun 2012 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Kevin Claytor

Very nice, needed something exactly like this, and it's quite easy to use.

5
24 Jun 2012 Replace strings in text file REPLACEINFILE replaces characters in ASCII file using PERL Author: Pekka Kumpulainen maryam

maryam (view profile)

5
16 Jun 2012 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Jiangmin zhang

i cannot do anything but give a five star! absolutely smarter than mathworks!

5
18 May 2012 Replace strings in text file REPLACEINFILE replaces characters in ASCII file using PERL Author: Pekka Kumpulainen Sebastian

Good job! Works great for me!

5
17 Apr 2012 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Aditya

Aditya (view profile)

  • 1 file
  • 130 downloads
  • 4.61538

Hey,

Great function. Pity I came across it after I spent much of my time writing a similar function. As some people have said above, I wanted the function to work with multiple rows/columns spanning subplots. So I included that capability in the following function:

http://www.mathworks.com/matlabcentral/fileexchange/35464-spaceplots

Just thought it might be useful to some.

5
17 Apr 2012 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Karl

Karl (view profile)

I second what Dan said. Spanning multiple columns/rows would be really useful. For example:
ha = tight_subplot(2,2,0.1,0.1,0.1)
axes(ha(1));plot(x1,y1);
axes(ha(2));plot(x2,y2);
axes(ha([3 4]))plot(x3,y3);

3
03 Apr 2012 MY_XTICKLABELS Replaces XTickLabels with "normal" texts accepting multiline texts and TEX interpreting Author: Pekka Kumpulainen Mauro Donzelli

4
03 Apr 2012 MY_XTICKLABELS Replaces XTickLabels with "normal" texts accepting multiline texts and TEX interpreting Author: Pekka Kumpulainen Mauro Donzelli

1
02 Mar 2012 MY_XTICKLABELS Replaces XTickLabels with "normal" texts accepting multiline texts and TEX interpreting Author: Pekka Kumpulainen Kristofer Kusano

Very nice, thanks for posting this

5
02 Mar 2012 MY_XTICKLABELS Replaces XTickLabels with "normal" texts accepting multiline texts and TEX interpreting Author: Pekka Kumpulainen Kristofer Kusano

5
01 Mar 2012 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Rakesh Chalasani

4
26 Jan 2012 Colored line or scatter plot Plot lines with CData, (actually surface) Author: Pekka Kumpulainen Pekka Kumpulainen

^ works fine up to million elements (didn't try with more).
The function does NOT refresh the plot. It only adds a new colored line.
Maybe you should clear the figure (clf).

Comment only
17 Jan 2012 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Ravi

Ravi (view profile)

Thanks a lot for the script.

5
10 Jan 2012 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Matthew Schroeder

Great work. Would be nice to be able to have the subplots fill a uipanel instead of the entire figure (doesn't play with within a GUI).

Comment only
10 Jan 2012 tight subplot Fills the figure with axes subplots with easily adjustable margins and gaps between the axes. Author: Pekka Kumpulainen Matthew Schroeder

4
09 Dec 2011 MY_XTICKLABELS Replaces XTickLabels with "normal" texts accepting multiline texts and TEX interpreting Author: Pekka Kumpulainen craq

craq (view profile)

This is a very useful tool. One suggestion though: the text() command gets confused if there is more than one axis, so maybe you can set the current axis to Ha with axes(Ha) before the cell '%% Make XTickLabels'.

4
29 Nov 2011 Colored line or scatter plot Plot lines with CData, (actually surface) Author: Pekka Kumpulainen Ulrich

Ulrich (view profile)

Unfortunately in my hands this function only seems to work for x shorter than 300 elements.

For example:

x = 1:301
color_line(x,sin(x),cos(x))

never generates a plot(i.e. the plot window never refreshes.)

For x=1:300 it works beautifully though.
Is there a simply way to make it work for longer x (e.g. 2500 points).

3
14 Nov 2011 Replace strings in text file REPLACEINFILE replaces characters in ASCII file using PERL Author: Pekka Kumpulainen ubuntu21 T

Ehsan suggested on 02 Jan 2011 to write the code for a sort of automatical switch between different OS. In my case, I have on my computer Windows and Ubuntu 10.04 Linux, so I have replaced the line

perlCmd = sprintf('"%s"',fullfile(matlabroot, 'sys\perl\win32\bin\perl'));

with

if findstr('glnx',lower(computer))
perlCmd = sprintf('"%s"',fullfile('/usr/bin/perl'));
else %assume it's windows otherwise
perlCmd = sprintf('"%s"',fullfile(matlabroot, 'sys\perl\win32\bin\perl'));
end

I have only tested on Ubuntu 10.04 Linux, with positive results on a 240 MB file. It works like a charm and very fast.

Comment only

Contact us