Answered
Writing X Y values from char to a txt file
If your char class variable is named |str|: fid = fopen( 'myFile.txt', 'w' ) ; fprintf( fid, strrep( str, ';', '\n' )) ; ...

12 years ago | 1

Answered
Primer Book for Matlab
You should be able to get it as PDF from <http://www.mathworks.com/help/releases/R2013b/pdf_doc/matlab/index.html here>. For the...

12 years ago | 1

Answered
Shadowing built-in functions
I am not using packages either (yet), but I would love to have an alternate version of ADDPATH which would mount folders as pack...

12 years ago | 3

| accepted

Answered
Importing XYZ matrix into Matlab
*EDIT:* see my second solution for a more flexible approach. *=== 1st solution.* % - Read content. fid = fopen( 'my...

12 years ago | 2

| accepted

Answered
create one cell in excel after one iteration
What are you trying to achieve with the line? Kapitalwert(1,1)=num2cell('ZFW%d', i); Type doc num2cell you'll see...

12 years ago | 1

| accepted

Answered
Create a new table based on cell array
Yes dataId = num2cell( 1:numel( cellarray )).' ; cData = [dataId, cellarray] ;

12 years ago | 0

| accepted

Answered
Regular Expression to detect spaces in a string
Here is an example assuming that you want characters between |"| and |&lt;/a&gt;| and not only white spaces: >> s = regexp(...

12 years ago | 3

Answered
how to read a text file and read it line by line?
If the string defining the composite number is stored in a variable named |theNumber|: count = numel( strfind( fileread('num...

12 years ago | 3

Answered
Trouble with While and If loops
You have to think again about the condition in the WHILE statement or about the increments that you are using. To see why, assum...

12 years ago | 1

| accepted

Answered
to which command refers ~isempty() to?
|ZoneElementProtNameUnder| is a 2D cell array. |ZoneElementProtNameUnder{1,1}| is the content of cell on column 1 and row 1 (c...

12 years ago | 2

| accepted

Answered
Matlab. Find the indices of a cell array of strings with characters all contained in a given string (without repetition)
Here is another solution, for the fun of it .. >> spectrum = @(s) accumarray(s.'-64, ones(size(s)), [58,1]) ; >> str_spec ...

12 years ago | 3

Answered
Please explain how to understand special strings like '^(\w:)?\'
*1.* Look at the following: % Windows type of absolute path. >> fullfile( 'C:\Temp', 'C:\Temp\myFile.txt' ) ans = ...

12 years ago | 1

| accepted

Answered
fundamental principle of multiplication
I guess that the following would work. I didn't think too much about it though and there must be a simpler or even trivial solut...

12 years ago | 0

Answered
Why subclass & superclass in OOP?
I am not sure that the room should be a super class for the desk actually, in the sense that the desk is not a specific type of ...

12 years ago | 19

| accepted

Answered
How to write into txt file
If fopen cannot open the file, fileID is -1. Valid file IDs are generally above 2 for files that you open by yourself (1 being _...

12 years ago | 1

Answered
Could someone explain how this code works?
The line temp = 0 ; is useless, and the |temp| which appear afterwards should be |f|, the output argument. Hint: cons...

12 years ago | 1

| accepted

Answered
Is there a reverse buffer function?
If you always have these parameters, I guess that a solution is y = x(1:10,2:end) + x(11:20,1:end-1) ; y =[y(:); x(11:20,e...

12 years ago | 2

| accepted

Answered
Detect edge and remove it
% - Read RGB image and convert to BW. BW = im2bw( imread( 'TEST_7.jpg' )) ; % - Build vectors of logicals targeting all...

12 years ago | 2

| accepted

Answered
Regular Expression to append a string in text file
Here is a simple and funny solution: txt = regexprep( fileread('Text_File.txt'), '([^\n\r]+)', '<s>$1</s>' ) ;

12 years ago | 1

| accepted

Answered
What's the best way to read an ASCII/txt file containing a few lines of text and then the data I want to load into a matrix?
If you always have the same number of header lines, use TEXTSCAN and set the parameter |'HeaderLines'| to a relevant value, e.g....

12 years ago | 2

| accepted

Answered
matlab coding question help~
Convert T into a vector with correct dimension and ordering, and then work in a vector way (I removed the ';' at the end of each...

12 years ago | 2

Answered
Find count of repeated letters (sequence)
Try to understand the following and fine-tune it to your needs: n = sum( diff([0, diff(a)==0]) == 1 ) In particular, eval...

12 years ago | 0

Answered
Extracting data from from all rows aside from those that contain NaN?
select = ~isnan( A ) ; % Vector of logicals, true at location corresponding % to non-NaN...

12 years ago | 4

| accepted

Answered
find a specific file
You could use the following function: function fName_out = convertFilename( fName_in ) match = regexp( fName_in, '[\d_]...

12 years ago | 1

| accepted

Answered
Delete rows in a .txt table
Here is a solution assuming that my comment above under your question was correct. % - Define run parameters. fileLocat...

12 years ago | 0

| accepted

Answered
find the smallest route
You can use a <https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm Dijkstra> or equivalent shortest path algorithm. The are sev...

12 years ago | 0

Answered
??? Subscripted assignment dimension mismatch
First: doc interp1 and once you understand roughly what it does and its input parameters, I guess that you could modify y...

12 years ago | 1

| accepted

Answered
Code and decode an entire struct to and from a plain string
What you are looking for is "MATLAB struct or object serialization" (on e.g. FEX or Google), but passing a serialized struct as ...

12 years ago | 3

| accepted

Answered
How do I print a formatted matrix without using a loop?
fprintf( fid, '%f %f %f %f %f %f\n', m.' ) ; where |fig| is the file identifier returned by FOPEN (or 1 if you want to tes...

12 years ago | 0

Answered
How can I determine if one class is superior or inferior to another?
You could use property SuperclassList from the output of METACLASS recursively .. Here is an example: function tf = isSub...

12 years ago | 1

Load more