Answered
Issue inserting file into another file at specific line
Keep the fixed portions A and B in separate files. Begin by copying part A to a new file, then write the data to that new file,...

10 years ago | 0

Answered
i am getting an error to plot this equation. what should i do?
Fix the lengths to match--your _theta_ isn't the same length as _time_ vector even though you wrote a loop over 1:length(time), ...

10 years ago | 0

Answered
Plot a function of two variables?
See example at doc meshgrid

10 years ago | 0

Answered
Can one read one line of string title followed by multiple lines of numeric data like FORTRAN?
As long as you don't have fixed-width fields with missing data, no problems with space-delimited files-- >> type ken.dat C...

10 years ago | 0

| accepted

Answered
how to fill a column with 1's between two specific values and with 0 otherwise?
Sometimes it's just simpler to loop... i1=find(v==1); % start i2=find(v==-1); % end if length(i2)>length(i1) % end ...

10 years ago | 0

| accepted

Answered
Moving the cross point of vertical and horizontal axes to (0,0)
If have recent version there's now a _'center'_ value on the position properties. If using earlier release, just answered a sho...

10 years ago | 0

Answered
token = strtok(str) Looking for Examples
My smiple-minded utility *tokens* that uses *strtok* -- function tok = tokens(s,d) % Simple string parser returns toke...

10 years ago | 0

Answered
Why do I get an invalid interpreter on my annotation request?
'Beta' isn't available; 'beta' is. That seems to fix it here...

10 years ago | 0

Answered
Open Files by File Name Patterns
Not amenable to the Matlab incarnation of the *dir* function, unfortunately--TMW has only implemented the '*' wildcard matching ...

10 years ago | 0

Answered
why the answer is coming as matrix and not a single number?
_" and how i can take two values for different conditions (equal pr not equal) if the answer is coming as matrix ...?"_ Well,...

10 years ago | 0

Answered
How to plot second y axis y2 that is just related to y1 as f(y1)
*plotyy* is about the simplest; it computes "nice" axes limits automagically that line up over the ranges of the two axes-- ...

10 years ago | 1

Answered
Take values from array within nested loop
_"Implement RMSE= sqrt{1/K* summation k=1:K [(theta_est-theta_true)]^2} [where] theta_est and theta_true may be of different len...

10 years ago | 0

Answered
Please help me in generating a matrix of ones for a given matrix
"Dead-ahead" solution is simply D = [4; 5; 3; 2; 4]; for row = 1:P ic=find(X(row,:); % the '1' column i...

10 years ago | 0

| accepted

Answered
hi,I wanted to know,if it is possible to plot some data in the same graph from two different M files?
Sure. See doc hold % 'on' after first to add to it Of course, it the two m-files are user-belligerent and do things lik...

10 years ago | 0

| accepted

Answered
Replace A single element of matrix
x(201,1)=240;

10 years ago | 4

| accepted

Answered
Plotting Legend in a For Loop
*plot* returns a _line_ handle; you're overwriting the previous handles on the subsequent passes thru the loop... j=0; % a...

10 years ago | 1

| accepted

Answered
How do I delete a specific line from a text file?
It's a sequential file so there isn't any way trivially to do what you want to the file itself. The right way would be to read ...

10 years ago | 0

| accepted

Answered
How to match two matrices in time while having different sizes?
Not clear what you intend, precisely, no...but-- If you're meaning to pick points from the more densely populated that corres...

10 years ago | 0

Answered
datevec text format problems
Not sure if there's a way to force the read or not but a fixup could be L=length('01/01/0000 00:00:00'); % saves me counti...

10 years ago | 1

| accepted

Answered
Matlab: NEMOH printing data on a specific line
*fgetl* is going to retrieve data from a file but *fopen(...,'w') discards any existing content in the file, if any, so you've a...

10 years ago | 0

| accepted

Answered
How do you crop a Matrix?
Pretty simply, just save what you want... Nkeep=324; % size to keep M=M(1:Nkeep,1:Nkeep); You can, of course, set th...

10 years ago | 1

Answered
xlsread: NaN is not recognized as Numeric Data
My release of Excel doesn't have NaN as a numeric entity; suspect it's not being returned because it isn't numeric. Look at the...

10 years ago | 1

Answered
Changing y axis range
How are we to know? The point of the above comment is that without knowing what you're doing there's nothing we can say specifi...

10 years ago | 0

Answered
Legend for two plots only applies to second plot
for i_plot = 1 : plot_step : N subplot(N, 1, i_plot) h_A = plot(bookmarksA(i_plot, :),0,'b.','MarkerSize',24); ...

10 years ago | 1

| accepted

Answered
How can I read a text file and import a part of it into matlab.
fmt=[repmat('%f',1,8) %*[^\n]']; % 8 values, skip rest of line format string fid=fopen('yourfilenamehere'); % open the ...

10 years ago | 0

| accepted

Answered
Xtick label alignment in bar plot
Variables = char('First', 'Second', 'Third',... 'Fourth', 'Large Name', 'Very Large Name', 'Small Name'); cau...

10 years ago | 0

| accepted

Answered
Is there code to recognize and allow me to browse and select CSV data?
Actually, building on Shameer's suggestion, [file,path] = uigetfile('*.csv','Select a CSV file'); if ischar(file) f...

10 years ago | 0

Answered
Is it possible to put an if statement into a for loops counter?
_"need a counter that stops at one of two values, which ever is reached first."_ while r < r1 && r < r2 r=r+1 whi...

10 years ago | 0

| accepted

Answered
Center a subplot in the figure
for i=1:10,hAx(i)=subplot(5,2,i);end % create the 5x2 array posn=mean(cell2mat(get(hAx(9:10),'position'))); % av...

10 years ago | 0

Answered
How to change units of a value?
Gotta' know the frame rate and image resolution...if known, pretty simple to scale the axes; if not, "no way, no how" _"362 p...

10 years ago | 1

| accepted

Load more