Searching through a large text file in Matlab [closed] - matlab

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Assuming we use Matlab, what is the best way to search for a string in a large text file (can be bigger than 1GB)? Reading the entire file into memory would be costly.

You need to look into this:Importing Large text data.
The method would be to use blocks. Load Data in blocks.
It can be done by the range input argument in xlsread. In the range itself, you can specify the columns as well..
Syntax:
num = xlsread(filename,sheet,xlRange)
Example:
filename = 'myExample.xlsx';
sheet = 1;
xlRange = 'B2:C3';
subsetA = xlsread(filename, sheet, xlRange)

Related

Is it possible to plot bars with filled pattern in Matlab [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
Is it possible to plot bars with filled pattern in Matlab, like this figure?
I attempted to use applyhatch_pluscolor link however, I couldn't make it work (attempt below). Is there an easy / feasible alternative?
Test code:
bar(rand(3,4));
[im_hatch,colorlist] = applyhatch_pluscolor(gcf,'\-x.',1,[],[],150);
Then I changed the source code, from bits = hardcopy(h,'-dzbuffer',['-r' num2str(dpi)]); to bits = print(h,'-RGBImage',['-r' num2str(dpi)]);.
I got the figure below. However, this is still far away form the desired result.

Matlab script to rename signal name [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have simulink block which has thousands of input signal for example which contains a text TRXA
AIM1_Freshness_TRXA_FCC,
AIM2_Freshness_TRXA_FCC
I need to create exact replica of the model only change is TRXA is changed to TRXB
AIM1_Freshness_TRXB_FCC ,
AIM2_Freshness_TRXB_FCC
Any easy or matlab script to do that
Does the following help?
open_system('your_model')
x = find_system('RegExp','on','FindAll','on','Name','TRXA');
for idx=1:size(x,1)
name_orig = get_param(x(idx),'Name');
set_param(x(idx),'Name',strrep(name_orig,'TRXA','TRXB'));
end

How to create a a:d:b vector to create and display "sin(0), sin(pi/n), sin((2*pi)/n), . . . , sin(2*pi)]" [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have been trying for a while to get this to work but I don't seem to be getting any closer to a solution.
I'm not sure of what the pattern is and what to write for the "d" value in a:d:b
Clearly you want to start from 0 (a) and go to 2*pi (b).
Now the question comes what is your step size (d)?
From your example you can see that you are changing from 0 to pi/n.
And from pi/n to 2*pi/n.
This means your step size is d=pi/n
Once you defined your n, e.g:
n=10;
you can do the rest like this:
x=0:(pi/n):(2*pi)
y=sin(x);

How can I do this (photo mosaic)? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I would like to create a picture from different pictures, i.e., a photo mosaic. I have 10 sample pictures to create an image of the Mona Lisa. I cropped those pictures to 150*(32x32) from 1*(480x320) for increase sample. I made vectors with those pictures and used k-means algorithm for clustring, but I am stuck.
How can I do this with Matlab?
Here is an example
You can do this by making a GUI-program in Matlab. So fare, you have to implement some functions like these:
function handles = loadImage(handles)
function resizeThumbs(path,thumbSize)
function handles = loadThumbs(handles)
function handles = genMosaic(handles)
If you have further questions ask.

Is there a way to get a function to perform the same operation on a list of variables in MATLAB? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
E.g. I'd like to perform a command like blitzer(blitzer(:,4)<0.5,5) on a list of variables (or all the variables in the workspace) in MATLAB.
So I'd like to perform it on comet, dasher, etc...
Use the who function:
s = who;
for i = 1:length(s)
temp = eval(s{i});
answer{i} = temp(temp(:,4)<0.5,5);
end