Answered
How can I select a .m file through browser push button option in GUI and add/save that file in my current Matlab working directory ? Any guidance is appreciated.TIA
[file,path] = uigetfile('*.m','Choose file to save'); copyfile([path file], pwd)

9 years ago | 0

| accepted

Answered
how to add elements in matrix
a = [2 6; 5 6]; result = sum(a');

9 years ago | 1

Answered
Connect two blocks in a subsytem
Hi Nedra, I couldn't load the image you have attached. You could give this a try: add_line('Mtest/Subsystem', 'Logical O...

9 years ago | 0

Answered
Need help to create matlab script to convert currency
Here is function for it : you can easily convert to a script if you want. function currencyTable = convertCurrency(toUsd, t...

9 years ago | 0

Answered
how to find differences in two simulink configuration settings using m-script
You can return a variable if you run the function 'active_config' after you have saved it as mentioned in the question. >> ...

9 years ago | 0

| accepted

Answered
Modifying discrete filter block simulink
Hi Adam, If you're trying to modify the sample time from the command prompt, this api might be helpful: >> load_system('...

9 years ago | 0

| accepted

Answered
List of structures as input to getfield()?
First Argument of 'getfield' should be a struct. `myStructList(i).name` probably refers to a char type variable. If myStruct...

9 years ago | 0

Answered
For-loop in Matlab
You don't even need a for loop c = 1:10; x = sind(c);

9 years ago | 1

Answered
double for loop with changing start point at second loop. need help, wrong output.
n = 10; result = zeros(n,n-1); for N1=1:1:(n-1) for N2=(N1+1):1:n result(N2,N1) = N2+N1; end ...

9 years ago | 0

| accepted

Answered
How can I find duplicate sub systems in model using m-script
This below code should work for reasonably simple subsystems. I haven't tried for any complex ones - like with triggered input. ...

9 years ago | 0

| accepted

Answered
M script: How to find which block is connected to which block?
>> load_system(myModel); >> allBlks = find_system(myModel, 'Type', 'block') Now this will give you all the blocks in the...

9 years ago | 3

| accepted

Answered
find a row with a column value don't remove duplicated cells
for j=1, it is trying to access data1{0,1} but matlab indexing starts from 1.

9 years ago | 0

| accepted

Answered
Creating a surface plot using Simulink?
Hi Vokler, if you already have designed the simulink model, you could simply use load_system and sim to get the output.

9 years ago | 0

Answered
Hello, i need the values in simulink..
From what I understand, you are trying to save the output of the simulation in an excel file, in place of viewing in the scope. ...

9 years ago | 0

Answered
About fixing a script
You have an error in 'mat2cell' function call in line 45 of your script. Please see the documentation to get more information on...

9 years ago | 0

| accepted

Answered
creating a new vector relative to the matrix
% A = your 10x6 original matrix; uRows = unique(A, 'rows'); result = zeros(6,1); for i=1:size(uRows, 1) ...

9 years ago | 0

| accepted

Answered
Singleton for database connection: availability problem
I became intrigued and scribbled something on my own. I guess you already know this stuff: classdef (Sealed) MyDBConnection...

9 years ago | 0

Answered
replace the string a cell array with empty cell
You may directly use the strrep function a = strrep(a, 'def', '');

9 years ago | 0

| accepted

Answered
matrix with elements sum of elements of old matrix
This would work, but maybe there's a better solution. a = [3 4 2 5]; a_new = a(1:end-1); a_new(end) = a_new(end) + a(...

9 years ago | 1

Answered
pls i need ful information and steps on how to use matlab to plot sin wave curve
You could find an example in the matlab documentation for plot function. >> doc plot

9 years ago | 0

Answered
computing first 50 terms of sequence
Keeping your code intact for most of the part, this is a quick fix x = zeros(2,50); x(:,1) = [1;0]; A = [1.52 -.7; .5...

9 years ago | 0

| accepted

Answered
picking data from excel
matlab provides an extensive documentation on xlsread. Please try and see if this helps doc xlsread

9 years ago | 0

| accepted

Answered
Contain outputs of function in one table(?)
1. If your output variables all have equal number of rows, you indeed can use a 'table' datatype. doc table 2. Otherwise...

9 years ago | 1

| accepted

Answered
How to replace data in a matrix by comparing from another matrix?
Assuming, the 'a' matrix has unique values in the first column for bRow= 1:size(b, 1) aRow = find(a(:,1)==b(bRow,1),...

9 years ago | 1

Answered
How do I loop through incrementally changing values
You could utilize the colon and element-wise operators, instead of looping. For example: alpha = 1:0.5:20; a = 0.1 + ...

9 years ago | 0

Answered
How do i create two multi-dimensional arrays:  a 10 x 10 x 10 numerical array (3-D) anda 5 x 5 x 5 x 5 numerical array (4-D) where each value in each array corresponds to the multiplication of indices?
This could be another approach: A = ones(10, 10, 10); for i=1:10 A(i,:,:) = A(i,:,:)*i; A(:,i,:) = A(:,i,:)*i;...

9 years ago | 2

| accepted

Answered
Color maps and for loops
I guess, this is what you're looking for: myMap = zeros(4,3); for i=1:4 myMap(i,1) = i/4; end firstCo...

9 years ago | 0

| accepted

Answered
add the particular column in the for loop
Are you looking for something like this? dataMatrix = [1 2 3; 4 5 6; 7 8 9]; outPut = zeros(size(dataMatrix,2),1); ...

9 years ago | 0

Answered
While loop for a menu
In my opinion, the proper way of doing this would be - using call-back functions. Please have a look if this documentation helps...

9 years ago | 0

| accepted

Load more