Answered
Automate the opening of .mat files and the aggregation of opened matricies
out=[]; for k=1:100 file=sprintf('output%d',k) M=load(file) f=fieldnames(M) A=M.(f) out=[out ...

9 years ago | 2

Answered
How to add numbers to indexes
idx=[2 3 4 5 1 6 7] numb=[1 4 6 8 3 7 9] numb(idx)

9 years ago | 0

| accepted

Answered
Why I get different data from 'to workspace' and 'scope'
Decrease the sample time of your to worksapce block

9 years ago | 0

Answered
How do I run my script on multiple files?
path='C:\Users\....' d=dir(fullfile(path,'*.txt')) file_names={d.name} formatSpec = '%f%*s%*s%*s%f%f%f%*s%*[^\n\r]'; for k...

9 years ago | 1

| accepted

Answered
Checking Cell Array for positive numbers
idx=a(:,1)>-150 & a(:,1)<0 out=sum(~idx)

9 years ago | 0

Answered
Import data from Excel, based on the cell content
Use xlsread to import your data, then take what you want. I think what you want is to locate the number 5 for example in your m...

9 years ago | 0

Answered
How to plot a box on an existing plot?
xmin=0; xmax=1; ymin=0; ymax=1; plot([xmin xmax xmax xmin xmin],[ymin ymin ymax ymax ymin]) or rectangle('position...

9 years ago | 1

| accepted

Answered
How to apply for loop for cell arrays?
a =(1000-0).*rand(10,2)+0 [r,c] = size(a) mina = [1 7] ; maxa = [6 10] ; b = cell(numel(mina),1) ; for o = 1:numel(mina) ...

9 years ago | 1

| accepted

Answered
How do I define a variable without assigning it a value?
You can use a Symbolic Math Toolbox <http://www.mathworks.com/help/symbolic/index.html>

9 years ago | 1

Answered
how to change number of rows in uitable ?
f = figure; data = cell(5,3); colnames = {'X', 'Y', 'Z'}; t = uitable(f, 'Data', data, 'ColumnName', colnames, ... 'Positi...

9 years ago | 2

| accepted

Answered
How to reduce the sampling time on dspace 1104 ?
Change the sampling time in your model configuration parameters

9 years ago | 0

Answered
Run length of consecutive integers in array
v=[1949 4 5 57;1949 12 27 58;1950 7 8 275;1950 7 6 276 ;1950 7 3 277 ] a=v(:,end) id=[0;diff(a)]==1 ii1=strfind(id',[0 1]) ...

9 years ago | 2

| accepted

Answered
Hello! I am facing problem in multiplication of 2 matrices.
Your result is a 77720x77720 double array, which is almost 50 Go of data, it can not be handled by Matlab. to know your limits, ...

9 years ago | 0

| accepted

Answered
Replace multiple rows by an array
c(logical(index),:)=repmat(Q,sum(index),1)

9 years ago | 0

| accepted

Answered
How to name a variable?
Read this <http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F> I don't know what i...

9 years ago | 0

Answered
How can I use strsplit, or something similar, in version 2012a?
a='abc def ghi' b=regexp(a,'\s+','split') Or b=regexp(a,'\S+','match')

9 years ago | 0

Answered
CELL to Matrix (Time/Date data)
load cell2date out=regexp(c,'\d+:\d+','match','once')

9 years ago | 0

| accepted

Answered
How to find row with maximum value of column?
[~,jj]=max(A)

9 years ago | 2

| accepted

Answered
Can someone do this calculation without for loops ?
a = [1 2 3; 4 5 6]; b = [ 1 2 3]; bb=reshape(b.*b,1,1,[]) out=bsxfun(@times,a,bb)

9 years ago | 0

Answered
convert array in matrix
load matlab a=cell2mat(pairs(:,1)) b=pairs(:,2) b=cell2mat([b{:}]')

9 years ago | 1

| accepted

Answered
Reading formatted text file in simulink
add to your function coder.extrinsic('textscan')

9 years ago | 0

Answered
Create array of all zeros
c=zeros(10,1); c=arrayfun(@(x) sprintf('%.4f',x),c,'un',0) %or c=zeros(10,1); sprintf('%.4f\n',c)

9 years ago | 1

| accepted

Answered
problem with using fprintf
fid=fopen('your_file.txt','w') x=25 str=sprintf('number of points: %d',x) fprintf(fid,'%s',str) fclose(fid)

9 years ago | 0

| accepted

Answered
array name indexing in matlab
This is not recommended <http://matlab.wikia.com/wiki/FAQ#How_can_I_create_variables_A1.2C_A2.2C....2CA10_in_a_loop.3F>

9 years ago | 2

Answered
How to make all the cells of equal size in matlab?
A=A(1:2244)

9 years ago | 0

Answered
How could I use a loop in this case?
A=[2010 08 09 07 14 40.26 6.2 30.391703 094.836545 0.70 0680912525.25 2012 08 09 05 49 55.93 5.6 30.321556 094.844720 0...

9 years ago | 1

| accepted

Answered
What is the data type of the output of the length function?
length(A) is always integer value, but the greatest integer value, is uint64(2^64-1). The length of an array could be greater th...

9 years ago | 0

Answered
How can I create a 3-d matrix from a 2-d matrix?
repmat(A,1,1,3)

9 years ago | 0

Answered
How can I see Matlab code (.mat) when we have .m?
.mat file doesn't contain a code, it contains data, if you want to see those data, type data=load('YourFile.mat') %or dat...

9 years ago | 0

Load more